0

我一直在使用此答案https://stackoverflow.com/a/11253806/2014236來設置對話框主題的樣式,使其看起來像AlertDialog。不過,我想使用支持庫中提供的'attr'。如何引用android.support.v7.appcompat.R.attr版本的buttonBarButtonStyle,而不是android.R.attr一個用在這裏:Android v7支持庫attr參考

<Button style="?android:attr/buttonBarButtonStyle" 
     android:layout_height="wrap_content" 
     android:layout_weight="wrap_content" 
     android:text="Button" /> 

我曾嘗試使用style="?android.support.v7.appcompat:attr/buttonBarButtonStyle"但這返回錯誤:

錯誤:沒有資源發現匹配給定名稱('樣式'值'android.support.v7.appcompat:attr/buttonBarButtonStyle')

儘管它在指定的包中,如下所示:https://developer.android.com/reference/android/support/v7/appcompat/R.attr.html#buttonBarButtonStyle

什麼是使用非android attrs /樣式的正確格式?

回答

0

看起來像這個效果很好。

<Button style="?attr/buttonBarButtonStyle" 
     android:layout_height="wrap_content" 
     android:layout_weight="wrap_content" 
     android:text="Button" />