ボタンの色が変わらないのはなぜですか?私のアプリケーションの色が上書きされないのはなぜですか?
<application android:label="Sales Plus" android:icon="@drawable/Icon"
android:theme="@style/AppTheme"></application>
のAppテーマは次のように定義されて
:
<style name="AppTheme.Base" parent="Theme.AppCompat.Light">
</style>
<!-- inherit from the AppCompat theme -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Color overrides -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<!-- Background Color Override -->
<item name="android:windowBackground">@color/window_background</item>
</style>
テーマはButtonSMため
<style name="ButtonTheme" parent="Widget.AppCompat.Button">
<item name="colorButtonNormal">@color/primary</item>
<item name="colorControlHighlight">@color/accent</item>
</style>
スタイリングを作成されます。
<style name="ButtonSm" parent="Widget.AppCompat.Button.Colored">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
テーマが適用されます。
<Button
android:text="@string/about"
android:id="@+id/btnAbout"
style="@style/ButtonSm"
android:theme="@style/ButtonTheme"
/>
ただし、表示されるボタンの色はデフォルトの緑です。 Xamarin.Android.Support.v7.AppCompatとAndroid Frameworkバージョン7.1(API lvl 25)の使用。また、ロリポップ...
でテストされ、私は私はすでにスタイルがありましたColoring Buttons in Android with Material Design and AppCompat
@ style/ButtonSmはどのようなスタイルですか? –
あなたのスタイル 'ButtonSm'のコードを表示して、テストを受けることができますか? –
追加したばかりのスニペットがあれば教えてください。 –