java将主题设置为具有自定义绘图功能的按钮
我有一个应用程序,其中我使用自定义绘图作为按钮背景。
然而,我并没有为聚焦、选定等状态创建单独的绘图。
我的问题是,如果不定义额外的绘图功能,是否可以使用默认Android突出显示按钮。全息彩色(蓝色)
你可以在下面搜索框中键入要查询的问题!
我有一个应用程序,其中我使用自定义绘图作为按钮背景。
然而,我并没有为聚焦、选定等状态创建单独的绘图。
我的问题是,如果不定义额外的绘图功能,是否可以使用默认Android突出显示按钮。全息彩色(蓝色)
# 1 楼答案
您可以使用选择器(状态列表),然后将其指定给布局中的视图,以修改视图在不同事件期间的行为方式
因此选择器(我们称之为myselector)可能如下所示:
然后在布局中为按钮设置选择器(如果需要,也可以在代码中设置):
应该是这样。您可以阅读选择器/状态列表here
希望这有帮助