I am develop in Android , I trying to set the UI
of button
by xml
.
The btn_corner.xml
(put in drawable
) is like the following: This xml
is use to set button UI
.
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg" >
<item>
<layer-list xmlns:android="http://ift.tt/nIICcg">
<item>
<shape android:shape="rectangle">
<solid android:color="#FFFFFF" />
<corners android:radius="5dp" />
<stroke android:width="1dp" android:color="#B1B1B1"/>
</shape>
</item>
<item android:bottom="30dp" android:left="3.5dp" android:right="3.5dp" android:top="1.5dp" android:drawable="@drawable/btn_shadow">
<shape android:shape="rectangle">
<solid android:color="#F2F1F1" />
<corners android:radius="5dp" />
<stroke android:width="1dp" android:color="#FFFFFF"/>
</shape>
</item>
</layer-list>
</item>
</selector>
And the part of xml
,
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:id="@+id/findCameraButton"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="4"
android:textColor="#00BBFF"
android:background="@drawable/btn_corners"
android:text="@string/label_find_camera" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
/>
<Button
android:id="@+id/cameraRecordButton"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="4"
android:layout_gravity="top"
android:textColor="#00BBFF"
android:background="@drawable/btn_corners"
android:text="@string/label_camera_record" />
<Space
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
/>
<Button
android:id="@+id/cameraSnapshotButton"
android:layout_width="0dp"
android:layout_height="60dp"
android:layout_weight="4"
android:textColor="#00BBFF"
android:background="@drawable/btn_corners"
android:text="@string/label_camera_snapshot" />
</LinearLayout>
But it show like the following:
Why the Button will move down after the button text change to 2 line?
Thanks in advance.
No comments:
Post a Comment