android Scrollview里的内容不停留在顶部的问题
来源:互联网 发布:招商迪辰软件 编辑:程序博客网 时间:2024/04/29 04:34
先说明一下:任何一个页面都应该按照布局的先后顺序来显示,我这出现的问题就是,Scrollview里面嵌套Listview的头布局一进来看不见了,直接被Listview把焦点给抢了。最先显示的是Listview的item部分。直接上图
解决代码在父布局里设置2个属性
android:focusable="true"android:focusableInTouchMode="true"
<?xml version="1.0" encoding="utf-8"?><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" tools:context="com.kyhh.youngworld.main.classification.activity.BrandListingActivity"> <include layout="@layout/system_titlebar_layouot" /> <com.kyhh.youngworld.widget.StickScrollView android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"><!--这是包裹Listview头布局的父布局,在这里添加属性-->
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true"> <ImageView android:layout_width="match_parent" android:layout_height="@dimen/length_200" android:src="@color/textgray2" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:gravity="center" android:orientation="vertical"> <TextView android:id="@+id/brandlist_tv_attention" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn_pressed" android:clickable="true" android:padding="5dp" android:text="关注" android:textSize="18sp" /> <TextView android:id="@+id/brandlist_tv_attentioncount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="关注人数" /> </LinearLayout> </RelativeLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/btn_pressed" android:gravity="center_vertical" android:orientation="horizontal" android:padding="10dp" android:tag="sticky"> <TextView android:id="@+id/brandlist_tv_integration" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="12dp" android:background="@drawable/btn_pressed" android:gravity="center" android:padding="5dp" android:text="综合排序" /> <TextView android:id="@+id/brandlist_tv_sales" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_centerInParent="true" android:background="@drawable/btn_pressed" android:gravity="center" android:padding="5dp" android:text="销量" /> <TextView android:id="@+id/brandlist_tv_price" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_alignParentRight="true" android:layout_marginRight="12dp" android:background="@drawable/btn_pressed" android:gravity="center" android:padding="5dp" android:text="价格" /> </RelativeLayout> <com.kyhh.youngworld.widget.NoScrollListview android:id="@+id/brandlist_xrc_goodslist" android:layout_width="match_parent" android:layout_height="match_parent"> </com.kyhh.youngworld.widget.NoScrollListview> </LinearLayout> </com.kyhh.youngworld.widget.StickScrollView></LinearLayout>
1 0
- android Scrollview里的内容不停留在顶部的问题
- ScrollView中嵌套 GridView 导致 ScrollView默认不停留在顶部的解决办法
- ScrollView中嵌套 GridView 导致 ScrollView默认不停留在顶部的解决方案和分析
- ScrollView 中嵌套 GridView 导致 ScrollView 默认不停留在顶部的解决方案和分析
- ScrollView中嵌套 GridView 导致 ScrollView默认不停留在顶部的解决方案和分析
- ScrollView中嵌套 GridView 导致 ScrollView默认不停留在顶部的解决方案和分析
- Scrollview 嵌套 listview 或 gridview 导致 ScrollView默认不停留在顶部的解决方案和分析
- 安卓ScrollView中嵌套 GridView 导致 ScrollView默认不停留在顶部的解决方案
- tableView的section不停留在顶部
- 解决ScrollView中有listView,造成不屏幕不停留在顶端的问题
- ScrollView 嵌套gridview 后 默认不停留在顶部
- ScrollView 不在顶部的问题
- Android Scrollview不能定位到顶部的问题?
- Android解决ScrollView嵌套ListView页面不在顶部的问题
- ScrollViewContainer scrollview容器的到顶部问题
- Android listview ,ScrollView 回到顶部的按钮
- Android -- 固定在ScrollView顶部的View
- android 里listview和ScrollView的冲突问题
- ES6学习17(SIMD)
- IntelliJ IDEA 中详细图解记录如何连接MySQL数据库
- ORACLE initialization or shutdown in progress
- 静态网页
- 左填充
- android Scrollview里的内容不停留在顶部的问题
- 单元测试那些事
- 奇偶剪枝问题 深搜搜到满足条件的路径时,不再搜其他路径
- LCD常用接口原理
- Python统计学一数据的概括性度量
- Java基础学习总结(8)——Java23种设计模式(Design Patterns)详解
- LeetCode217 Contains Duplicate
- 织梦采集侠采集问题
- JQuery插件ajaxFileUpload小记