android - Center two buttons horizontally -


i try arrange 2 buttons (with images on them work fine) next each other , center them horizontally. that's have far:

<linearlayout android:orientation="horizontal" android:layout_below="@id/radiogroup"               android:layout_width="wrap_content" android:layout_height="wrap_content"               android:layout_gravity="center_horizontal|center">     <button             android:id="@+id/allow"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_below="@id/radiogroup"             android:layout_gravity="center_horizontal"             android:drawableleft="@drawable/accept_btn"             android:text="allow"/>     <button             android:id="@+id/deny"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_torightof="@id/allow"             android:layout_below="@id/radiogroup"             android:layout_gravity="center_horizontal"             android:drawableleft="@drawable/block_btn"             android:text="deny"/> </linearlayout> 

unfortunately still aligned left side. appreciated! yves

edit:

unfortunately none of comments or suggestions work far. that's why try provide simplified, full layout relativelayout:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"             android:layout_width="fill_parent" android:layout_height="wrap_content"             android:layout_centerhorizontal="true">     <textview android:text="@+id/textview01" android:id="@+id/textview01"           android:layout_width="wrap_content" android:layout_height="wrap_content"/>     <button         android:id="@+id/allow"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@id/textview01"         android:text="allow"/>     <button         android:id="@+id/deny"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_torightof="@id/allow"         android:layout_aligntop="@id/allow"         android:text="deny"/> </relativelayout> 

i've tried combinations of attributes in linearlayout , on button elements without luck. other ideas?

this solution:

<?xml version="1.0" encoding="utf-8"?> <relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent" android:layout_height="wrap_content"     android:layout_centerhorizontal="true">      <textview         android:text="@+id/sometext"         android:id="@+id/textview01"         android:layout_width="wrap_content" android:layout_height="wrap_content" />      <linearlayout         android:orientation="horizontal"         android:background="@android:drawable/bottom_bar"         android:paddingleft="4.0dip"         android:paddingtop="5.0dip"         android:paddingright="4.0dip"         android:paddingbottom="1.0dip"         android:layout_width="fill_parent" android:layout_height="wrap_content"         android:layout_below="@+id/textview01">          <button             android:id="@+id/allow"             android:layout_width="0.0dip" android:layout_height="fill_parent"             android:text="allow"             android:layout_weight="1.0" />          <button             android:id="@+id/deny"             android:layout_width="0.0dip" android:layout_height="fill_parent"             android:text="deny"             android:layout_weight="1.0" />      </linearlayout> </relativelayout> 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -