這是我的代碼。我從來沒有看到我的應用程序有任何變化。我在resources/drawable
中創建了這個。我應該如何在一個樣式應用動態主題爲所有組件通過改變文本color
,fonts
,shapes
等如何改變textview,button的角落形狀,通過動態應用主題來編輯文本?
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" android:padding="20dp">
<solid android:color="#FFA500"/>
<corners android:bottomRightRadius="50dp" android:bottomLeftRadius="50dp"
android:topLeftRadius="50dp" android:topRightRadius="50dp"/>
<stroke android:color="#FFA500" android:dashWidth="50dp" />
</shape>
不是動態的,因爲我注意到主題/樣式不支持動態。所以我在Xml工作。 –
好..只是看到你的代碼...只是嘗試動態地聲明背景.. Button button =(Button)findviewbyid(r.id.yourid); button.setBackgroundResource(R.drawable.yourxmlfile); ...我認爲代碼適合你 –
是的,我注意到了。它已被改變,尤其是按鈕形狀。但我不應該在Java(Activity)中調用它。我需要在一個Xml文件中做到這一點。當我調用主題時,它必須完全應用於我的應用程序中的所有按鈕。 –