android listview 禁止滚动
生活随笔
收集整理的這篇文章主要介紹了
android listview 禁止滚动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在一個項目中,使用了listview和3個include 布局。
結果發現listview為?wrap_content 時,無法撐開布局。但是所有布局并未占滿屏幕。另外,在include中調用軟鍵盤時,listview依然不動,導致編輯內容的位置比較別扭。
反復試驗,總結就是為listview設置高度。但是似乎? ?listview.setOverScrollMode(View.OVER_SCROLL_NEVER);? 不起作用。 布局代碼如下:
(由于?ScrollView 內部只能有一個元素,因此用linearLayout 包括其它元素。)
<LinearLayout 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:orientation="vertical" ><Toolbar android:id="@+id/stb"android:layout_width="match_parent"
android:layout_height="wrap_content" /><ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:orientation="vertical"android:layout_height="wrap_content"><ListViewandroid:id="@+id/plv"android:layout_width="match_parent"android:layout_height="230dp"tools:ignore="NestedScrolling" /><includeandroid:id="@+id/plable"layout="@layout/style_lable" /><includeandroid:id="@+id/poffset"layout="@layout/price_offset" /><includeandroid:id="@+id/pedit"layout="@layout/style_edit" /></LinearLayout></ScrollView> </LinearLayout>
? ? ??
轉載于:https://www.cnblogs.com/htsky/p/11370925.html
總結
以上是生活随笔為你收集整理的android listview 禁止滚动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vue设置全局变量和修改
- 下一篇: ntellijIDEA用鼠标滚轮调整代码