日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

android在屏幕最下方,如何将view固定在屏幕底部?

發布時間:2024/10/8 编程问答 36 豆豆
生活随笔 收集整理的這篇文章主要介紹了 android在屏幕最下方,如何将view固定在屏幕底部? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

答:Janusz

(最佳答案)

我認為你可以試試RelativeLayout.,這樣你可以用android:layout_alignParentBottom將button移動到屏幕底部。如果在Relative Layout中,底部沒有顯示相關內容,或許就是在它之前的layout占據了整個屏幕。如果出現這種情況,你可以最先在layout文件夾中設定view的位置,然后用android:layout_above將其它的內容設置在view之上。這樣,底部的view可以占據更多的空間,layout中其它的內容也可以充分顯示。

答:Bram Avontuur

在ScrollView中,這種方法不起作用,因為無論ScrollView是否置于底部,RelativeLayout都會重疊。所以,我選擇FrameLayout來進行固定:

android:layout_height="fill_parent" android:layout_width="fill_parent"

android:fillViewport="true">

android:layout_width="fill_parent" android:layout_height="fill_parent"

xmlns:android="http://schemas.android.com/apk/res/android"

android:orientation="vertical">

android:layout_width="fill_parent" android:layout_height="fill_parent"

android:layout_weight="1">

答:pseudosudo

你可以在Linear Layout中新建RelativeLayout:

android:orientation="vertical"

android:layout_width="fill_parent"

android:layout_height="fill_parent">

android:id="@+id/TextView"

android:layout_width="fill_parent"

android:layout_height="wrap_content">

android:layout_width="match_parent"

android:layout_height="match_parent">

android:id="@+id/Button"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:layout_alignParentBottom="true"

android:layout_alignParentRight="true">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_toLeftOf="@id/Button"

android:layout_alignParentBottom="true">

答:Timores

Janusz的答案很正確,但是我覺得用RelativeLayouts并不是最佳選擇,所以我介紹一種“filler”方法,將TextView設定為空白:

android:layout_width="fill_parent"

android:layout_weight="1" />

總結

以上是生活随笔為你收集整理的android在屏幕最下方,如何将view固定在屏幕底部?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。