9Patch的棒棒糖呈灰色椭圆背景 [英] 9Patch on Lollipop shows gray oval in background

查看:186
本文介绍了9Patch的棒棒糖呈灰色椭圆背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下按钮:

<Button
    android:layout_height="32dp"
    android:layout_marginTop="4dp"
    android:layout_marginLeft="@dimen/aecs_item_inner_padding_positive"
    android:id="@+id/aecsTelephone"
    android:layout_width="wrap_content"
    android:layout_gravity="center_horizontal"
    android:layout_below="@id/aecsServicesContainer"
    android:layout_alignParentLeft="true"
    android:text="Mobile"
    android:background="@drawable/selector_mobile_button" />

和它具有以下背景选择器:

and it has the following background selector:

<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/mobile_btn_pressed" android:state_pressed="true"></item>
    <item android:drawable="@drawable/mobile_btn"></item>
</selector>

这是棒棒堂只有背景显示了一个椭圆形的灰色层和我没有从那里显示在该层中的任何线索?

on Lollipop only the background shows an oval gray layer and I don't have any clue from where this layer is shown?

需要注意的是使用无9补丁版本图像的解决了这个问题,但我不知道为什么!

Note that using the none 9-patch version of the image fixes the problem, but I don't know why!

mobile_btn.9.png

mobile_btn.9.png

棒棒糖截图:

Lollipop Screenshot:

奇巧截图:

KitKat Screenshot:

编辑: 的问题得到解决。 Okay..It是在9片图像的透明度,我用它从华电国际的文件夹,当它被缩放的透明度区域被破坏。但是我仍然感到震惊,为什么地球上的问题显示出来的棒棒糖而已。当我使用的图像,因为它是没有任何规模的问题得到解决。

The problem is solved. Okay..It was in the transparency of the 9-patch image, I used it from the hdpi folder and when it gets scaled the transparency area gets corrupted. However I am still shocked why on earth the problem shows up on Lollipop only. After I used the image as it is without any scale the problem is fixed.

推荐答案

使用的TextView ,并设置机器人:可调焦=真正的如果您不需要默认的按钮造型。该按钮部件只是一个很小的一套关于的TextView 的顶部性质,包括默认的提升和Z深度动画。

Use TextView and set android:focusable="true" if you don't need the default Button styling. The Button widget is just a tiny set of properties on top of TextView and includes default elevation and z-depth animation.

这篇关于9Patch的棒棒糖呈灰色椭圆背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆