Android Linear Layout (3 buttons) cannot centre of the screen -


i want make 3 button should align centre of '+id/imagerecorder'. 3 buttons start edge of screen now, hopes help

and here xml code, how make 3 buttons centre of screen.

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:background="@color/mybackground"     android:orientation="vertical" >       <imageview         android:id="@+id/imagerecorder"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centerhorizontal="true"         android:layout_margintop="10dp"         android:src="@drawable/recorder" />      <radiogroup         android:id="@+id/radiogroupaudio"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centerhorizontal="true"                 android:layout_margintop="20dp"         android:layout_below="@+id/imagerecorder"         android:orientation="horizontal" >          <radiobutton             android:id="@+id/radiowav"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:onclick="onradiobuttonclicked"             android:text="@string/wav"             android:textappearance="?android:attr/textappearancemedium"             android:textcolor="@color/mytext" />          <radiobutton             android:id="@+id/radiomp3"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:onclick="onradiobuttonclicked"             android:text="@string/mp3"             android:textappearance="?android:attr/textappearancemedium"             android:textcolor="@color/mytext" />     </radiogroup>      <linearlayout         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_margintop="30dp"         android:layout_centerhorizontal="true"                         android:layout_below="@+id/radiogroupaudio"         android:orientation="horizontal" >          <imagebutton             android:id="@+id/buttonstart"             android:layout_width="76dp"             android:layout_height="44dp"             android:background="#00ffffff"             android:scaletype="fitxy"             android:layout_marginright="20dp"             android:layout_toleftof="@+id/buttonpause"             android:src="@drawable/play_off" />          <imagebutton             android:id="@+id/buttonpause"             android:layout_width="76dp"             android:layout_height="44dp"             android:background="#00ffffff"             android:scaletype="fitxy"             android:layout_below="@+id/imagerecorder"             android:layout_centerinparent="true"                         android:src="@drawable/pause_off" />          <imagebutton             android:id="@+id/buttonstop"             android:layout_width="76dp"             android:layout_height="44dp"             android:background="#00ffffff"             android:scaletype="fitxy"             android:layout_marginleft="20dp"             android:layout_torightof="@+id/buttonpause"             android:src="@drawable/stop_off" />     </linearlayout>  </relativelayout> 

try change:

    android:layout_centerhorizontal="true"  

to:

    android:gravity="center_horizontal" 

in linearlayout 3 buttons


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -