【发布时间】:2016-04-17 01:53:01
【问题描述】:
我有一个垂直搜索栏,并使用自定义可绘制对象作为拇指。在手机上,一切正常,但在平板电脑上,搜索栏拇指图像被放大。下面是一些截图:
电话:http://i.imgur.com/Ca4wcav.png
平板电脑:http://i.imgur.com/7a5LRb4.png
这里是drawable的代码:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<size
android:height="30dp"
android:width="20dp" />
<solid android:color="@android:color/transparent"/>
</shape>
</item>
<item android:drawable="@drawable/scroll_thumb" android:width="28dp" android:height="23dp" android:top="3dp">
</item>
</layer-list>
drawable/scroll_thumb 是400x300px左右的实际图片。
我尝试了一些我认为可行的方法,例如:
Drawable leftThumb = getDrawable(R.drawable.seekbar_thumb);
Drawable rightThumb = mRightSeek.getThumb();
leftThumb.setBounds(100, 100, 50, 50);
rightThumb.setBounds(0, 0, 0, 0);
mLeftSeek.setThumb(leftThumb);
mRightSeek.setThumb(rightThumb);
以上似乎都没有效果。造成这种扩大的原因是什么,解决方法是什么?
【问题讨论】:
标签: android android-layout android-drawable android-seekbar xml-drawable