安卓_神坑的scrollbarSize
来源:互联网 发布:淘宝女装代销选货技巧 编辑:程序博客网 时间:2024/04/29 14:21
今天需要求改下scrollbar的大小.觉得他太长过了.不好看..
就在属性里面添加多
android:scrollbarSize="20DP"这么一段
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbarSize="20px"
android:scrollbars="vertical" >
android:scrollbarSize="20dp"
</ScrollView>
但发现没效果呀.坑爹啊.然后搜索下.得到这么个连接. https://code.google.com/p/android/issues/detail?id=14317
内容如下:后面有翻译
For example, in case of the following tag in xml layout, android:scrollbarSize is ignored.<ScrollViewandroid:layout_width="wrap_content" android:layout_height="fill_parent"android:fadeScrollbars="false"android:scrollbarThumbVertical="@drawable/thumb01"android:scrollbarSize="20px">For your information, drawable/thumb01.xml is the following for example.<shape xmlns:android="http://schemas.android.com/apk/res/android"><solid android:color="#FF0000"/><corners android:radius="4px"/></shape>But it works well when android:scrollbarThumbHorizontal attribute is added in the same ScrollView tag.For example below.<ScrollViewandroid:layout_width="wrap_content" android:layout_height="fill_parent"android:fadeScrollbars="false"android:scrollbarThumbVertical="@drawable/thumb01"android:scrollbarThumbHorizontal="@drawable/thumb01"android:scrollbarSize="20px">Of course, android:scrollbarThumbHorizontal means nothing in this case.I believe that this problem is caused by View class of android.view package.Hereinafter, the target version is Android 2.3 (Gingerbread). The problem is in source code of View.java, several lines from 5940 line.The "size" variable is the size of "horizontal" scrollbar of 5940 line.But, this variable seems to be used as the size of "vertical" scrollbar at 5972 and 5974 lines.It is necessary to get the size of vertical scrollbar before 5972 line, is it ?就是说.他发现要同时添加多这么两行后.才有用.
android:scrollbarThumbVertical="@drawable/thumb01"android:scrollbarThumbHorizontal="@drawable/thumb01"为啥呢?这是安卓系统里面一个bug. 在View.java这个文件里面 .没搞好.设置错了.
解决方案:
<ScrollViewandroid:layout_width="wrap_content" android:layout_height="fill_parent"android:fadeScrollbars="false"android:scrollbarThumbVertical="@drawable/thumb01"android:scrollbarThumbHorizontal="@drawable/thumb01"android:scrollbarSize="20px">
thumb01.xml长这样的:
<shape xmlns:android="http://schemas.android.com/apk/res/android"><solid android:color="#FF0000"/><corners android:radius="4px"/></shape>上面这个方案实测有用.!!!!然后还搜到另外一个方案:在Res /values/Styel里面加多这个Style.然后设置scrollbar为这个style.....我试了.没鸟用.你们自己试下有没用吧<resources> <style name="ShowAllScrollBar1"> <item name="android:scrollbarSize">20px</item> </style></resources>
0 0
- 安卓_神坑的scrollbarSize
- 安卓_关于时间的运算
- 安卓_异常_
- 安卓_侧滑
- 安卓_动画
- 安卓_解析
- 安卓_缓存
- 安卓_动画_帧动画
- 安卓基础学习_应用的界面编程
- 安卓_ edittext的使用小全
- 安卓开发_编辑框内容的增减
- 安卓学习_基于TCP协议的网络通信
- 安卓_开发者必备的6款源码搜索引擎
- 一篇关于_安卓内存抖动的文章
- 安卓_数据库泄露
- 安卓_弹出消息
- 安卓_延时操作;
- 安卓_了解Fragment
- 后序线索二叉树
- 100层楼扔2个鸡蛋、3个鸡蛋……
- Android系统自带样式(android:theme)(转)
- 1111111111111111111
- sql 批量修改,根据不同的条件来修改数据
- 安卓_神坑的scrollbarSize
- 孙鑫VC++深入详解(8):定制应用程序外观
- Android Volley请求出现乱码
- 创建PDF文件 - iOS开发
- 怎么看源码
- 程序猿的24个段子
- MySQL DATE_FORMAT() 函数
- iOS开发- 只能选择iOS Device,无法选择模拟器解决办法
- JAVA中重写equals()方法为什么要重写hashcode()方法?