您的位置:首页 > 移动开发 > Android开发

Android开发中遇到的系统组件bug

2016-04-05 14:38 543 查看
Android开发中遇到的系统组件bug持续更新…

1. 部分版本RecycleView无法下拉刷新异常

SwipeRefreshLayout
嵌套
RecycleView
隐藏第一项
holder.itemView.setVisibility(View.GONE)
导致嵌套在
SwipeRefreshLayout
中导致无法下拉刷新, 解决方案隐藏项使用

ViewGroup.LayoutParams params = holder.itemView.getLayoutParams();
if (显示) {//显示当前项
params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
holder.itemView.setLayoutParams(params);
} else {//隐藏当前项
params.height = 0;
holder.itemView.setLayoutParams(params);
}


2. Support包版本24.0.0-alpha1RecycleView异常

使用24.0.0-alpha1的support包导致RecycleView每一项的布局文件最外层如果使用match_parent, 则每一项都可能被撑开以至于占据整个屏幕高度,解决方法使用wrap_content 或者指定 24.0.0-alpha1之前的包

3. TextView竖直滚动问题

在设置了 android:maxLines=”3” 和 android:autoLink=”all” 之后导致文字会上下滚动

<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:autoLink="all"
android:ellipsize="end"
android:gravity="center_vertical"
android:maxLines="3"
android:paddingLeft="@dimen/space_normal"
android:paddingRight="@dimen/space_normal"
android:text=""
android:textColor="#666666"
android:textColorLink="@color/linked"
android:textSize="16sp"
/>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息