Android按钮拒绝缩小其在表格中的大小?
我有一个按钮在桌子上,但按钮在屏幕上延伸,从而拉伸了我的图像,使其难看。我尝试过包装内容、填充父项和匹配父项,但它们都给出相同的结果。这是我的xml。为什么按钮不缩小它的尺寸Android按钮拒绝缩小其在表格中的大小?,android,xml,button,Android,Xml,Button,我有一个按钮在桌子上,但按钮在屏幕上延伸,从而拉伸了我的图像,使其难看。我尝试过包装内容、填充父项和匹配父项,但它们都给出相同的结果。这是我的xml。为什么按钮不缩小它的尺寸 <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/bg2"
android:orientation="vertical" >
<TableRow>
<ImageView
android:contentDescription="@string/contents"
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:paddingTop="10dp"
android:src="@drawable/lesson1" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/alpha"
android:paddingLeft="15dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:textStyle="italic"
android:text="@string/alphanote"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/directions2"
android:paddingLeft="15dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow>
<Button
android:id="@+id/Button1"
android:layout_width="14dp"
android:background="@drawable/playstart" />
</TableRow>
<TableRow>
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/alpha1"
/>
</TableRow>
</TableLayout>
</ScrollView>
如果你只有一列,我不知道你为什么要为TableLayout和TableRow而烦恼。TableLayout适用于多列表 也就是说,您不能通过上述任何方法控制TableLayout中列的宽度。相反,在TableLayout本身上使用和
我甚至不确定这是否有效,因为TableLayout背后的要点是尽量将行填充到表的宽度。您可能应该将其转换为简单的垂直线性布局。我需要使用scrollview并将按钮并排放置。@user3623689:您没有任何按钮并排放置。要在TableLayout中有多个列,一个或多个TableRow元素需要有多个子元素。所有TableRow元素都有一个子元素,因此只有一列。另外,你只有一个按钮。