0
我正在構建基於Android操作系統的最新版本的示例應用程序。根據給出的指令here我想給我的應用程序中只有一個按鈕全息:燈主題。我該怎麼做 ?我在res/values文件夾中創建了一個myStyles.xml,但我無法找到屬性來應用全光主題。全息燈主題沒有設置在按鈕上
這是我在myStyles.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="mybutton" parent="android:Theme.Holo.Light">
<item name="android:background">@android:color/holo_orange_light</item>
<item name="android:textColor">@android:color/holo_blue_dark</item>
</style>
</resources>
這是我在我的活動。
<Button
android:id="@+id/button1"
style="@style/mybutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="lol" />
我可以確認backgroundcolor和textcolor正在得到應用......(爲測試目的完成此操作)。 目前,如果我將android:theme =「@ android:style/Theme.Holo.Light」添加到AndroidManifest.xml,則holo light主題將應用於整個應用程序。不過,我希望這個主題僅適用於少數控件(在這種情況下是單個按鈕控件)。