我在做我自己的搜索视图为Android 2.3。
I'm making my own search view for Android 2.3.
我有。
的LinearLayout
(水平)
AutoCompleteTextView
的ImageButton
LinearLayout
(Horizontal)
AutoCompleteTextView
ImageButton
我添加的按钮和 AutoCompleteTextView
到的LinearLayout
。
我想提出一个圆角半径在我自己的控制如下所示的图像。
I want to put a corner radius in my own control like the image shown below.
我设置可绘制到的ImageButton
I set this drawable to ImageButton
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" >
<shape>
<solid
android:color="#27AFE0" />
<stroke
android:width="0.5dp"
android:color="#000000" />
<corners
android:topRightRadius="10dp" android:bottomRightRadius="10dp"
android:topLeftRadius="0.1dp"
android:bottomLeftRadius="0.1dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="#D3DBDE"/>
<stroke
android:width="0.5dp"
android:color="#000000" />
<corners
android:topRightRadius="10dp" android:bottomRightRadius="10dp"
android:topLeftRadius="0.1dp"
android:bottomLeftRadius="0.1dp" />
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp" />
</shape>
</item>
绘制到AutoCompleteText
drawable to AutoCompleteText
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#D3DBDE"/>
<stroke android:width="0.5dp" android:color="#000000"/>
<corners android:topLeftRadius="10dp"
android:bottomLeftRadius="10dp"
android:topRightRadius="0.1dp"
android:bottomRightRadius="0.1dp"/>
</shape>
</item>
但是当我运行这是Android 2.3,这是输出(模拟器和真实设备)
But when I run this in android 2.3 this is the output (Emulator and Real Device)
如果我在的Android 4.0也运行。它工作正常。
If I run also in Android 4.0 . It works fine.
问题是,什么是错误的,我code?或者有错误,在Android 2.3的?
Question is, what's wrong in my code? Or There's bug in Android 2.3?
推荐答案
好了,所以这里是这打勾我送行,以及这笔交易。有两件事情与此有关。
Ok so here is the deal this ticked me off as well. There are 2 things with this.
在你的ImageButton选择,你似乎在每个角落标签两次复制属性的右下角。
In your ImageButton Selector, you seemed to copy the attributes for the right corners twice in each corner tag.
二是在Android的一个错误,直到3.0版。当单独指定的角落,左下角和右上角得到翻转。
The second is a bug in android up until version 3.0. When specifying the corners separately, the bottom left and right corners get flipped.
http://$c$c.google.com/p/android/issues/detail?id=9161
我已经提取的价值观出梦诗,把他们在两个不同的文件,
I have extracted the values out to dimens and put them in two different files,
RES /价值/ corners.xml - 以扭转的东西
res/values/corners.xml - with the reversed stuff
RES /值-V12 / corners.xml - 在他们的理智值
res/values-v12/corners.xml - with the sane values in them.
相关推荐
最新文章