android - Horizontal Align elements inside a ViewPager -


so problem following... have relativelayout has 3 main elements. column 2 buttons on left, on right , scrollview layout on center contains viewpager , button.

the button aligns fine it's parent. can not viewpager align itself.

here xml layout.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal">  <linearlayout     android:id="@+id/leftbuttons"     android:weightsum="1"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_marginleft="10dip"     android:orientation="vertical"     android:layout_alignparentstart="true"     >      <space         android:layout_weight="0.5"         android:layout_width="match_parent"         android:layout_height="0dip" />     <imagebutton         android:id="@+id/leftarrowbtn"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@android:color/transparent"         android:contentdescription="@string/left_arrow"         android:gravity="center_vertical|center_horizontal"         android:src="@drawable/arrow_left_selector"         android:layout_marginbottom="60dip"         />      <imagebutton         android:id="@+id/leftarrowbtnall"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@android:color/transparent"         android:contentdescription="@string/left_arrow"         android:gravity="center_vertical|center_horizontal"         android:src="@drawable/arrow_left_selector_all" /> </linearlayout>  <scrollview     android:id="@+id/middlelayouts"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_centerinparent="true"     android:layout_torightof="@+id/leftbuttons"     android:layout_toleftof="@+id/rightbuttons"     >      <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:orientation="vertical"         android:paddingtop="35dip"         android:gravity="center_horizontal"         >          <button             android:id="@+id/selectdate"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_marginbottom="20dip"             android:background="@drawable/default_button_rounded"             android:drawablepadding="35dip"             android:drawableright="@drawable/ic_date_light"             android:gravity="center_vertical|center_horizontal"             android:paddingbottom="5dip"             android:paddingleft="25dip"             android:paddingright="25dip"             android:paddingtop="5dip"             android:text="@string/monthly_statistics_"             android:textcolor="@color/light_bg" />          <android.support.v4.view.viewpager             android:id="@+id/view_pager"             android:layout_width="wrap_content"             android:layout_height="match_parent"             android:gravity="center_horizontal"         />     </linearlayout> </scrollview>  <linearlayout     android:id="@+id/rightbuttons"     android:weightsum="1"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_marginright="10dip"     android:orientation="vertical"     android:layout_alignparentend="true"     >     <space         android:layout_weight="0.5"         android:layout_width="match_parent"         android:layout_height="0dip" />     <imagebutton         android:id="@+id/rightarrowbtn"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@android:color/transparent"         android:contentdescription="@string/right_arrow"         android:gravity="center_vertical|center_horizontal"         android:src="@drawable/arrow_right_selector"         android:layout_marginbottom="60dip"         />      <imagebutton         android:id="@+id/rightarrowbtnall"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@android:color/transparent"         android:contentdescription="@string/right_arrow"         android:gravity="center_vertical|center_horizontal"         android:src="@drawable/arrow_right_selector_all" /> </linearlayout> 

here screenshot of how looks... enter image description here

and here screenshot of layout editor shows me table should aligned....

i've tried kind of layouts and, gravitys, etc.. can not center! :(

thanks

enter image description here

to me, looks linear layout, inside scrollview, should have width of match_parent instead of wrap_content

<scrollview     android:id="@+id/middlelayouts"     android:layout_width="wrap_content"     android:layout_height="match_parent"     android:layout_centerinparent="true"     android:layout_torightof="@+id/leftbuttons"     android:layout_toleftof="@+id/rightbuttons"     >      <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="vertical"         android:paddingtop="35dip"         android:gravity="center_horizontal"         > 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -