Android换肤

 http://www.eoeandroid.com/forum-viewthread-tid-73500-extra-page%3D1%26orderby%3Ddateline.html

一个apk应用访问另一个apk包中的资源,可以实现换肤。

ps: 在AndroidManifest.xml中设置sharedUserId


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Context friendContext = null;
    try {
        friendContext = this.createPackageContext(
        "com.test.android.skin.myskin", Context.CONTEXT_IGNORE_SECURITY);
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
    Button btn = (Button) findViewById(R.id.btn);
    btn.setBackgroundDrawable(friendContext.getResources().getDrawable(
    R.drawable.btn_background));
}