1) 軟件內置多個皮膚,不可由用戶增加或修改;
最低的自由度,軟件實現相對於後兩種最容易。
2) 官方提供皮膚供下載,用戶可以使用下載的皮膚;
用戶可選擇下載自己喜歡的皮膚,有些玩家會破解皮膚的定製方法,自己做皮膚使用,或者傳到網上給大家用。
參考:http://blog.csdn.net/zhyooo123/article/details/6697186
3) 官方提供皮膚製作工具或方法,用戶可自制皮膚。
關於主題和樣式:
- package irdc.ex03_21;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.View;
- import android.view.View.OnClickListener;
- import android.widget.Button;
- public class EX03_21 extends Activity implements OnClickListener{
- /** Called when the activity is first created. */
- Button button = null;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- Utils.onActivityCreateSetTheme(this);
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- findViewById(R.id.button1).setOnClickListener(this);
- findViewById(R.id.button2).setOnClickListener(this);
- findViewById(R.id.button3).setOnClickListener(this);
- }
- @Override
- public void onClick(View v)
- {
- System.out.println("單擊按鈕");
- // TODO Auto-generated method stub
- switch (v.getId())
- {
- case R.id.button1:
- System.out.println("主題1");
- Utils.changeToTheme(this, 1);
- break;
- case R.id.button2:
- System.out.println("主題2");
- Utils.changeToTheme(this, 2);
- break;
- case R.id.button3:
- System.out.println("主題3");
- Utils.changeToTheme(this, 3);
- break;
- }
- }
- }
- package irdc.ex03_21;
- import android.app.Activity;
- import android.content.Intent;
- public class Utils
- {
- private static int sTheme;
- public final static int THEME_DEFAULT = 0;
- public final static int THEME_WHITE = 1;
- public final static int THEME_BLUE = 2;
- /**
- * Set the theme of the Activity, and restart it by creating a new Activity
- * of the same type.
- */
- public static void changeToTheme(Activity activity, int theme)
- {
- sTheme = theme;
- activity.finish();
- activity.startActivity(new Intent(activity, activity.getClass()));
- }
- /** Set the theme of the activity, according to the configuration. */
- public static void onActivityCreateSetTheme(Activity activity)
- {
- switch (sTheme)
- {
- default:
- case 1:
- activity.setTheme(R.style.Theme_Translucent);
- break;
- case 2:
- activity.setTheme(R.style.Theme_Translucent2);
- break;
- case 3:
- activity.setTheme(R.style.Theme_Transparent);
- break;
- }
- }
- }
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <TextView
- android:textColor="@drawable/darkgreen"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/str_text_view1"
- />
- <Button
- android:id="@+id/button2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="主題1" />
- <Button
- android:id="@+id/button1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="主題2" />
- <Button
- android:id="@+id/button3"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="主題3" />
- </LinearLayout>
- <img src="https://img-my.csdn.net/uploads/201205/13/1336912506_5495.png" alt="">