Edited at

com.android.internal.R のリソースにアクセス

More than 5 years have passed since last update.

private なリソースでもアクセス出来ます。

例)QuickSearchBox の表示

参考:http://mpigulski.blogspot.com/2011/03/accessing-comandroidinternalr-resources.html


resource_access_test.java

package com.wakuworks.test;

import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.LinearLayout;

public class SearchBarActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

int id = Resources.getSystem().getIdentifier("search_bar", "layout", "android");

LinearLayout linearLayout = new LinearLayout(this);
LayoutInflater factory = LayoutInflater.from(this);
factory.inflate(id, linearLayout);

setContentView(linearLayout);
}
}