簡體   English   中英

如何在Android中以編程方式刪除默認按鈕樣式

[英]How to programmatically remove default button style in android

我刪除了背景,但陰影仍在按鈕下方。

我知道以下屬性將刪除XML按鈕的樣式。

style="?android:attr/borderlessButtonStyle" 

但是,我如何以編程方式完成此任務?

TypedValue typedValue = new TypedValue();
getContext().getTheme().resolveAttribute(R.attr.selectableItemBackground, typedValue, true);
yourButton.setBackgroundResource(typedValue.resourceId);

干得好!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM