Reputation: 2010
I designed one layout with 3 button, I want to manage separator's alignment. here my xml layout ,
<RelativeLayout
android:id="@+id/menuLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
>
<Button
android:id="@+id/btn_Menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#00000000"
android:drawableTop="@drawable/menu"
android:text="@string/menu"
android:textColor="@color/restaurant_list_menu_font"
android:textStyle="bold" />
<View
android:layout_width="5dp"
android:layout_height="35dp"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/btn_Menu"
android:gravity="center"
android:layout_gravity="center"
android:background="@drawable/sep" />
<Button
android:id="@+id/btn_Review"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#00000000"
android:drawableTop="@drawable/reviews"
android:text="@string/pages"
android:textColor="@color/restaurant_list_menu_font"
android:textStyle="bold" />
<View
android:layout_width="5dp"
android:layout_height="35dp"
android:layout_centerInParent="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="15dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/btn_page"
android:background="@drawable/sep"
android:gravity="center"
android:layout_gravity="center"
/>
<Button
android:id="@+id/btn_page"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#00000000"
android:drawableTop="@drawable/pages"
android:gravity="center_horizontal"
android:text="@string/reviews"
android:textColor="@color/restaurant_list_menu_font"
android:textStyle="bold" />
</RelativeLayout>
I want to manage View with center of 2 button here is Current output
3 buttons are managed but I also want to manage alignment of this separator image..
Upvotes: 0
Views: 1438
Reputation: 405
Instead of using the separator image as your background, add an imageView to the views, make the view fill the entire gap and center that imageview in the parent. For as far as I know, there is no option on how the background should be positioned i a view.
Another way is to put them all in a Linear Layout, use imageViews instead of Views and use weights to position them correctly.
Upvotes: 1