如何在布局inflater中更改按钮宽度?

时间:2013-04-26 11:52:29

标签: android android-layout

我按照本教程http://karanbalkar.com/tag/dialog/进行布局inflater告诉我如何更改inflater sao按钮中的按钮宽度将在inflater上全宽?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:id="@+id/layouttimer">   

 <Button 
 android:id="@+id/start"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:layout_gravity="center_horizontal"
 android:text="Start Timer" > 
 </Button>   

 <Button 
 android:id="@+id/stop"
 android:layout_width="wrap_content"android:layout_height="wrap_content"
 android:layout_gravity="center_horizontal"
 android:text="Stop Timer" > 
 </Button>   

 <TextView
 android:id="@+id/tv"
 android:layout_width="fill_parent"
 android:layout_height="wrap_content"
 android:layout_gravity="center"
 android:gravity="center"
 android:text=""/>  

</LinearLayout> 

1 个答案:

答案 0 :(得分:0)

将按钮上的android:layout_width="wrap_content"更改为android:layout_width="fill_parent"

您可以尝试将此添加到按钮:

 android:layout_alignParentLeft="true"
 android:layout_alignParentRight="true"