Android 5似乎忽略了可绘制的XML的重力
我有一个可绘制的
XML,将用作某些视图的背景。它将在视图中添加边框,并在右侧放置图标。这在较新的Android版本上正常工作,但是在Android 5上,它在中间显示图标。
这是drawable
xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape>
<padding android:left="8dp" android:right="8dp" />
<stroke android:color="@color/somecolor" android:width="2dp" />
</shape>
</item>
<item android:drawable="@drawable/ic_keyboard_arrow_down_text_color_24dp" android:width="24dp" android:height="24dp" android:gravity="right|center_vertical">
</item>
</layer-list>
</item>
</selector>
看来android:gravity =“ right | center_vertical”
在&lt; item&gt;
上忽略图标。
知道如何解决这个问题?
谢谢。
I have a drawable
xml that will be used as the background for some views. It will add a border to the view and put an icon on the right hand side. This is working fine on newer Android versions but on Android 5 it is displaying the icon in the middle.
This is the Drawable
xml:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<layer-list>
<item>
<shape>
<padding android:left="8dp" android:right="8dp" />
<stroke android:color="@color/somecolor" android:width="2dp" />
</shape>
</item>
<item android:drawable="@drawable/ic_keyboard_arrow_down_text_color_24dp" android:width="24dp" android:height="24dp" android:gravity="right|center_vertical">
</item>
</layer-list>
</item>
</selector>
It appears that android:gravity="right|center_vertical"
is ignored on the <item>
that is just an icon.
Any idea how to fix this?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论