我有以下代码,但按钮的宽度不是全屏。那是从我不想要的按钮两侧留下的小空间。我想要整个屏幕宽度水平覆盖。
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#848484"
tools:context="com.example.bepolite.BePolite" >
<Button
android:id="@+id/sign_up"
android:layout_width="fill_parent"
android:layout_height="80sp"
android:text="Sign Up"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="30sp"
android:background="@drawable/button_signup"
style="?android:attr/borderlessButtonStyle" />
<Button
android:id="@+id/Log_in"
android:layout_width="fill_parent"
android:layout_height="80sp"
android:text="Login"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="30sp"
android:background="@drawable/button_login"
style="?android:attr/borderlessButtonStyle" />
<Button
android:id="@+id/whatisbepolite"
android:layout_width="fill_parent"
android:layout_height="80sp"
android:text="Uderstanding Being Polite???"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="30sp"
android:background="@drawable/button_whatisbeingpolite"
style="?android:attr/borderlessButtonStyle" />
</TableLayout>
答案 0 :(得分:0)
只需从布局中删除填充。删除这些行,您的视图应该看起来很好:
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"