3
我只是想知道,如果它能够防止按钮大小调整为其分配长文本时。防止按钮调整大小当文字太长?
我想在我的布局中放置2行4个按钮,但只要我在一个文本中更改文本,它会自动调整大小压缩其他文件,因此没有任何大小均匀。
我已经尝试过体重,体重总和,但是我不得不承认我对这些属性的理解不足!
这是迄今为止我的XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearLayout1"
android:background="@drawable/backgroundrepeat"
android:orientation="vertical"
android:weightSum="2">
<ScrollView android:id="@+id/scrollView1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_weight="2">
<TextView android:id="@+id/textView1"
android:layout_width="match_parent"
android:text="TextView"
android:layout_height="wrap_content">
</TextView>
</ScrollView>
<LinearLayout android:layout_height="wrap_content"
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_weight="1"
android:weightSum="4.0"
android:gravity="left">
<Button android:text="Button"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1.0">
</Button>
<Button android:text="Button"
android:gravity="center"
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1.0">
</Button>
<Button android:text="Button"
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1.0">
</Button>
<Button android:id="@+id/button4"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Button" android:layout_weight="1.0">
</Button>
</LinearLayout>
<LinearLayout android:layout_height="wrap_content"
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_weight="1"
android:weightSum="4.0"
android:gravity="left">
<Button android:text="Button"
android:id="@+id/button5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1.0">
</Button>
<Button android:text="Button"
android:gravity="center"
android:id="@+id/button6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1.0">
</Button>
<Button android:text="Button"
android:id="@+id/button7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_weight="1.0">
</Button>
<Button android:id="@+id/button8"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Button" android:layout_weight="1.0">
</Button>
</LinearLayout>
</LinearLayout>
已分配的宽度为两个按钮为“包裹的内容”,因此其它happening.change一些固定值宽度,也可以设置省略号。 – Pravy