开发者

How do you make a custom button shape keep the systems colors?

开发者 https://www.devze.com 2023-01-23 08:13 出处:网络
I am creating custom shapes for certain buttons but I want them to maintain the systems current color scheme. I thought that by not applying a gradient or color开发者_如何学编程 it would automagically

I am creating custom shapes for certain buttons but I want them to maintain the systems current color scheme. I thought that by not applying a gradient or color开发者_如何学编程 it would automagically take care of this for me but I am mistaken. By doing that I end up with a black button and black text.

Any pointers?

Obligatory code:

<shape android:shape="rectangle">
  <corners android:radius="1dp" android:bottomRightRadius="0dp" android:bottomLeftRadius="7dp" android:topLeftRadius="0dp" android:topRightRadius="7dp" />
</shape>


Nope, those are actually png images with a Selector. You would need to use the same image in your selector, although you can imitate something close using the gradient APIs. When you change the background you lose the color scheme.

0

精彩评论

暂无评论...
验证码 换一张
取 消