[英]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.