android listview 禁止滚动
生活随笔
收集整理的這篇文章主要介紹了
android listview 禁止滚动
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
在一個(gè)項(xiàng)目中,使用了listview和3個(gè)include 布局。
結(jié)果發(fā)現(xiàn)listview為?wrap_content 時(shí),無(wú)法撐開布局。但是所有布局并未占滿屏幕。另外,在include中調(diào)用軟鍵盤時(shí),listview依然不動(dòng),導(dǎo)致編輯內(nèi)容的位置比較別扭。
反復(fù)試驗(yàn),總結(jié)就是為listview設(shè)置高度。但是似乎? ?listview.setOverScrollMode(View.OVER_SCROLL_NEVER);? 不起作用。 布局代碼如下:
(由于?ScrollView 內(nèi)部只能有一個(gè)元素,因此用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>
? ? ??
轉(zhuǎn)載于:https://www.cnblogs.com/htsky/p/11370925.html
總結(jié)
以上是生活随笔為你收集整理的android listview 禁止滚动的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: vue设置全局变量和修改
- 下一篇: ntellijIDEA用鼠标滚轮调整代码