码迷,mamicode.com
首页 > 移动开发 > 详细

android listview 禁止滚动

时间:2019-08-18 00:10:43      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:schema   包括   位置   line   nested   mat   price   mic   com   

在一个项目中,使用了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"> <LinearLayout android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content"> <ListView android:id="@+id/plv" android:layout_width="match_parent" android:layout_height="230dp" tools:ignore="NestedScrolling" /> <include android:id="@+id/plable" layout="@layout/style_lable" /> <include android:id="@+id/poffset" layout="@layout/price_offset" /> <include android:id="@+id/pedit" layout="@layout/style_edit" /> </LinearLayout> </ScrollView> </LinearLayout>

技术图片
     
技术图片
    技术图片

android listview 禁止滚动

标签:schema   包括   位置   line   nested   mat   price   mic   com   

原文地址:https://www.cnblogs.com/htsky/p/11370925.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!