1.主Activity中的的主xml文件:
<RelativeLayout 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" >
<ProgressBar
style="@style/my_pg_style"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
2.复制系统中的progressBar样式:
获取的路径:F:AndroidSDKandroid-sdkplatformsandroid-16data esvaluesstyles.xml
<style name="my_pg_style">
<item name="android:indeterminateOnly">true</item>
<item name="android:indeterminateDrawable">@drawable/progress_medium_white</item>
<item name="android:indeterminateBehavior">repeat</item>
<item name="android:indeterminateDuration">3500</item>
<item name="android:minWidth">48dip</item>
<item name="android:maxWidth">48dip</item>
<item name="android:minHeight">48dip</item>
<item name="android:maxHeight">48dip</item>
</style>
progress_medium_white 文件是在:F:AndroidSDKandroid-sdkplatformsandroid-16data esdrawableprogress_medium_white.xml 得到的
3.系统主题:
获取系统主题的路径:F:AndroidSDKandroid-sdkplatformsandroid-16data esvalues heme.xml
<style name="Red_NoTitleBar">
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:background">#ff0000</item>
</style>
<style name="Blue_NoTitleBar" parent="@style/Red_NoTitleBar"> <!--继承关系-->
<item name="android:background">#00ff00</item>
</style>
作用在Manifest中的 Activity上面,
<activity android:theme="@style/Blue_NoTitleBar" android:name="com.example.styletheme2.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>