我已经为我正在开发的测试程序实现了一个简单的布局。屏幕上只有一个徽标图像、一个带有程序标题的 textView 和一个按钮。我正在尝试使用线性布局,因为我希望每个元素都换行。就我而言,图像和文本可能非常接近,但我希望按钮出现在页面底部。我不明白我做错了什么。我还使用“底部”值将 android:layoutGravity 属性添加到按钮中,但没有任何改变。这是我正在使用的代码:
<ScrollView 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:background="@drawable/background">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="0sp"
tools:context=".DiLand"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0sp"
android:src="@drawable/logo2" />
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/titleApp"
android:textColor="@color/titleColor"
android:textSize="35sp"
android:gravity="top"
android:layout_marginTop="0sp"
/>
<Button
android:layout_width="140sp"
android:layout_height="50sp"
android:text="@string/startButton"
android:id="@+id/start_button"
android:background="@drawable/start_button"
android:textColor="@color/whiteColor"
android:textSize="30sp"
android:layout_gravity="bottom"
/>
</LinearLayout>
</ScrollView>
感谢帮助!