導航:首頁 > 操作系統 > fillviewportandroid

fillviewportandroid

發布時間:2023-01-03 06:27:11

A. 移動開發 android:fillViewport="true" , android:scrollbars="none" 是干什麼的呀求詳解

android:fillViewport="true"

當一個高度值不足scrollview的子控制項fillparent的時候,單獨的定義android:layout_height="fill_parent"是不起作用的,必須加上fillviewport屬性,當子控制項的高度值大於scrollview的高度時,這個標簽就沒有任何意義了。

android:scrollbars="none"

隱藏滾動條

B. 安卓界面虛擬鍵盤彈出下面布局怎麼頂上去

有時候我們需要這種效果,鍵盤彈出,底部的內容跟隨上移。今天我就實現了這樣一個小小的效果
我們直接來看布局文件main.xml
[java] view plain
<?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"
android:gravity="bottom">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1.0">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:orientation="vertical"
android:scrollbars="vertical">
<EditText
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>

</ScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<Button android:id="@+id/smit_btn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="上 傳"
android:layout_weight="1.0"/>

<Button android:id="@+id/cancel_btn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:text="取 消" />"

</LinearLayout>
</LinearLayout>

當ScrollView里的元素想填滿ScrollView時,使用"fill_parent"是不管用的,必需為ScrollView設置:android:fillViewport="true"。

這樣做 底部的上傳和取消會隨著軟鍵盤的彈出而上移。

閱讀全文

與fillviewportandroid相關的資料

熱點內容
程序員刪除代碼是怎麼樣的 瀏覽:1
電子商務pdf 瀏覽:541
致遠伺服器地址埠 瀏覽:219
如何查水逆的APP 瀏覽:88
python中有序字典 瀏覽:543
系統和伺服器的運維什麼意思 瀏覽:454
程序員看重的內容 瀏覽:361
程序員8折 瀏覽:96
社會變遷pdf 瀏覽:902
程序員怎麼選擇MacBookPro配置 瀏覽:635
phoenix命令 瀏覽:487
字體文件放到那個文件夾 瀏覽:54
設計院如何選用伺服器 瀏覽:187
吃毛蛋解壓視頻 瀏覽:586
python要素在列表中的位置 瀏覽:371
q7的壓縮比 瀏覽:375
什麼叫源碼編譯器 瀏覽:227
加密數字貨幣的市場 瀏覽:245
linux切換資料庫的命令是 瀏覽:944
武漢車子解壓可以自己辦嗎 瀏覽:169