如何在我的项目中添加在线创建的 android 主题
how to add online created android theme in my project
我是 android 应用程序的新手 development.I 使用过 http://android-holo-colors.com/
为我的应用程序创建主题。
它创建了一个名为 ei_theme 的主题。
我得到了可绘制文件夹、布局和值文件夹。
值文件夹由 colors_ei_theme、dimens_ei_theme、styles_ei_theme、themes_ei_theme.
组成
现在我很困惑要在清单文件中添加什么才能使用主题。
我猜你不能在清单中的应用程序标签中添加多个主题。
你能告诉我如何使用这些吗?
这里是styles的内容_ei_theme
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with http://android-holo-colors.com -->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-<style parent="android:Widget.Holo.AutoCompleteTextView" name="AutoCompleteTextViewEi_Theme">
<item name="android:dropDownSelector">@drawable/ei_theme_list_selector_holo_dark</item>
<item name="android:background">@drawable/ei_theme_edit_text_holo_dark</item>
</style>
-<style parent="android:Widget.Holo.Button" name="ButtonEi_Theme">
<item name="android:background">@drawable/ei_theme_btn_default_holo_dark</item>
</style>
-<style parent="android:Widget.Holo.ImageButton" name="ImageButtonEi_Theme">
<item name="android:background">@drawable/ei_theme_btn_default_holo_dark</item>
</style>
-<style name="TabEi_Theme">
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
<item name="android:background">@drawable/ei_theme_tab_indicator_holo</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">80dip</item>
</style>
-<style name="TabTextEi_Theme">
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<!-- v14 <item name="android:textAllCaps">true</item> -->
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
<item name="android:maxWidth">180dip</item>
</style>
</resources>
这里是主题内容_ei_theme
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with http://android-holo-colors.com -->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-<style parent="android:Theme.Holo" name="Ei_Theme">
<item name="android:editTextBackground">@drawable/ei_theme_edit_text_holo_dark</item>
<item name="android:textColorHighlight">#9933b5e5</item>
<item name="android:textSelectHandleLeft">@drawable/ei_theme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/ei_theme_text_select_handle_right</item>
<item name="android:textSelectHandle">@drawable/ei_theme_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewEi_Theme</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/ei_theme_btn_check_holo_dark</item>
<item name="android:listChoiceIndicatorSingle">@drawable/ei_theme_btn_radio_holo_dark</item>
<item name="android:buttonStyle">@style/ButtonEi_Theme</item>
<item name="android:imageButtonStyle">@style/ImageButtonEi_Theme</item>
</style>
</resources>
有两种方法可以通过 AndroidManifest.xml 文件将主题应用到您的 activity。
1- 在 application 标签中应用主题。这会将此主题应用于应用程序中的所有活动,例如:
<application
android:theme = "@style/Ei_Theme" >
...
</application>
2- 在 application 下的 AndroidManifest.xml 中将主题分别应用到每个 activity 标签。这仅将此主题应用于 activity:
<application >
<activity
android:theme = "@style/Ei_Theme" >
...
</activity>
</application>
我是 android 应用程序的新手 development.I 使用过 http://android-holo-colors.com/ 为我的应用程序创建主题。
它创建了一个名为 ei_theme 的主题。 我得到了可绘制文件夹、布局和值文件夹。 值文件夹由 colors_ei_theme、dimens_ei_theme、styles_ei_theme、themes_ei_theme.
组成现在我很困惑要在清单文件中添加什么才能使用主题。 我猜你不能在清单中的应用程序标签中添加多个主题。 你能告诉我如何使用这些吗?
这里是styles的内容_ei_theme
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with http://android-holo-colors.com -->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-<style parent="android:Widget.Holo.AutoCompleteTextView" name="AutoCompleteTextViewEi_Theme">
<item name="android:dropDownSelector">@drawable/ei_theme_list_selector_holo_dark</item>
<item name="android:background">@drawable/ei_theme_edit_text_holo_dark</item>
</style>
-<style parent="android:Widget.Holo.Button" name="ButtonEi_Theme">
<item name="android:background">@drawable/ei_theme_btn_default_holo_dark</item>
</style>
-<style parent="android:Widget.Holo.ImageButton" name="ImageButtonEi_Theme">
<item name="android:background">@drawable/ei_theme_btn_default_holo_dark</item>
</style>
-<style name="TabEi_Theme">
<item name="android:gravity">center_horizontal</item>
<item name="android:paddingLeft">16dip</item>
<item name="android:paddingRight">16dip</item>
<item name="android:background">@drawable/ei_theme_tab_indicator_holo</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:minWidth">80dip</item>
</style>
-<style name="TabTextEi_Theme">
<item name="android:textColor">#ffffff</item>
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<!-- v14 <item name="android:textAllCaps">true</item> -->
<item name="android:ellipsize">marquee</item>
<item name="android:maxLines">2</item>
<item name="android:maxWidth">180dip</item>
</style>
</resources>
这里是主题内容_ei_theme
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with http://android-holo-colors.com -->
-<resources xmlns:android="http://schemas.android.com/apk/res/android">
-<style parent="android:Theme.Holo" name="Ei_Theme">
<item name="android:editTextBackground">@drawable/ei_theme_edit_text_holo_dark</item>
<item name="android:textColorHighlight">#9933b5e5</item>
<item name="android:textSelectHandleLeft">@drawable/ei_theme_text_select_handle_left</item>
<item name="android:textSelectHandleRight">@drawable/ei_theme_text_select_handle_right</item>
<item name="android:textSelectHandle">@drawable/ei_theme_text_select_handle_middle</item>
<item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextViewEi_Theme</item>
<item name="android:listChoiceIndicatorMultiple">@drawable/ei_theme_btn_check_holo_dark</item>
<item name="android:listChoiceIndicatorSingle">@drawable/ei_theme_btn_radio_holo_dark</item>
<item name="android:buttonStyle">@style/ButtonEi_Theme</item>
<item name="android:imageButtonStyle">@style/ImageButtonEi_Theme</item>
</style>
</resources>
有两种方法可以通过 AndroidManifest.xml 文件将主题应用到您的 activity。
1- 在 application 标签中应用主题。这会将此主题应用于应用程序中的所有活动,例如:
<application
android:theme = "@style/Ei_Theme" >
...
</application>
2- 在 application 下的 AndroidManifest.xml 中将主题分别应用到每个 activity 标签。这仅将此主题应用于 activity:
<application >
<activity
android:theme = "@style/Ei_Theme" >
...
</activity>
</application>