[英]android linearlayout push button
嗨,我有2個項目進入linearlayout,我需要將它們推到屏幕底部。 現在,它們也從屏幕開始。 我該怎么做?
<?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:orientation="vertical">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="bottom"
android:gravity="bottom"
android:src="@drawable/splash" />
<include
android:layout_gravity="bottom"
android:id="@+id/footer_raw"
android:layout_width="fill_parent"
android:gravity="bottom"
android:layout_height="30dp"
layout="@layout/footer_raw" />
</LinearLayout>
用RelativeLayout
替換LinearLayout
並將android:layout_alignParentBottom
=“ true”賦予footer_raw
將android:layout_gravity="bottom"
到您的父級布局。
將您的代碼更改為此
<?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:layout_gravity="bottom"
android:orientation="vertical">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="bottom"
android:gravity="bottom"
android:src="@drawable/splash" />
<include
android:layout_gravity="bottom"
android:id="@+id/footer_raw"
android:layout_width="fill_parent"
android:gravity="bottom"
android:layout_height="30dp"
layout="@layout/footer_raw" />
</LinearLayout>
將此屬性應用於您的商品,
機器人:layout_gravity = “底部”。 或使用相對布局作為父布局。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.