style.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppBaseTheme" parent="android:Theme.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme"> <!-- 主题AppTheme继承AppBaseTheme -->
</style>
<style name="jiangnanstyle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">22sp</item>
<item name="android:textColor">#00ff00</item>
</style>
<style name="pangzhi" parent="jiangnanstyle">
<item name="android:textSize">30sp</item>
</style>
<style name="pangzhi.lizhi" > <!-- style名字是lizhi继承pangzhi -->
<item name="android:textColor">#0000ff</item>
</style>
<style name="myTheme">
<item name="android:background">#ff0000</item>
</style>
</resources>
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical"
>
<TextView
android:text="@string/hello_world"
style="@style/jiangnanstyle"
/>
<TextView
android:text="@string/hello_world"
style="@style/pangzhi"
/>
<TextView
android:text="@string/hello_world"
style="@style/pangzhi.lizhi"
/> <!-- lizhi继承pangzhi -->
<TextView
android:text="@string/hello_world"
style="@style/jiangnanstyle"
/>
<TextView
android:text="@string/hello_world"
style="@style/jiangnanstyle"
/>
</LinearLayout>
国际化是通过系统选择不同的国家后再加载不同的语言和图片。
本文转自农夫山泉别墅博客园博客,原文链接:http://www.cnblogs.com/yaowen/p/4957881.html,如需转载请自行联系原作者