Android viewpager is not match_parent in LARGE screen -
Android viewpager is not match_parent in LARGE screen -
i have viewpager in view below:
<?xml version="1.0" encoding="utf-8"?> <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/ci_pager" android:layout_width="match_parent" android:layout_height="match_parent" />
and has 3 fragments populated later via adapter, testing on normal screen (my smartphone) fills whole device's width below action bar, when test on big screen (samsung tablet) becomes part of action bar , takes around 30% of action bar, it's not below action bar more, it's positioned @ left of action bar. can cause this? in advance
edit: 3 fragments: frag_ci_info.xml
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center_horizontal" > <imageview android:id="@+id/ci_info_big_image" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp"> <imageview android:id="@+id/ci_info_prev" android:layout_width="20dp" android:layout_height="40dp" android:layout_marginleft="5dp" android:src="@drawable/prev" android:layout_alignparentleft="true" android:layout_centervertical="true"/> <horizontalscrollview android:id="@+id/ci_info_horizontal_sv" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@color/scroll_view_background" > <linearlayout android:id="@+id/ci_info_small_image_container" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center_vertical" > </linearlayout> </horizontalscrollview> <imageview android:id="@+id/ci_info_next" android:layout_marginright="5dp" android:layout_width="20dp" android:layout_height="40dp" android:src="@drawable/next" android:layout_alignparentright="true" android:layout_centervertical="true"/> </relativelayout> <mp1.com.widgets.filledtextview android:id="@+id/ci_info_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" /> <webview android:id="@+id/ci_info_description" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </linearlayout> </scrollview>
and frag_ci_hotel.xml
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" > <linearlayout android:id="@+id/ci_hotels_list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> </linearlayout> </scrollview>
and frag_ci_wonders.xml
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background" > <linearlayout android:id="@+id/ci_wonders_list" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> </linearlayout> </scrollview>
and here's how create tabs:
public void oncreate(bundle bundle) { super.oncreate(bundle); setcontentview(r.layout.ci_info_details); setactionbartitle(getresources().getstring(r.string.title_ci_details)); int id = getintent().getextras().getint("id"); _viewpager = (viewpager) findviewbyid(r.id.ci_pager); _tabpageradapter = new ci_citydetailsadapter(getsupportfragmentmanager()); //async job fetching info ci_infojob cij = new ci_infojob(this, id); cij.execute(); (string tab_name : tabs) { //i assume here's problem ??? it's adding tabs actionbar... _actionbar.addtab(_actionbar.newtab().settext(tab_name) .settablistener(this)); } }
edit: here screen shots both devices.
this mobile:
this tablet:
android android-fragments android-actionbar android-viewpager
Comments
Post a Comment