"SubjectTabActivity"が1つあり、このアクティビティでlistviewを表示する必要があります。
しかし、私はListActivityを実装したいとき、それはlistActivityを表示しません。
"SubjectTabActivity"という2つの(addchapter、addsubject)xmlファイルがあります。私は
それぞれのXMLファイルで私のデータベースアイテムのilリストビューを表示する必要があります。しかし、私は理解していません
それを行う方法?
TabActivityでリサーチ機能を追加する方法。
私に参照やコードを教えてください。事前に
おかげ..
は、ここに私の参照コードです。 タブアクティビティでリストビューを追加するには?
public class MasterMainActivity extends TabActivity
{
LayoutInflater layoutInflater = null;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.master);
Intent intent=getIntent();
setResult(RESULT_OK, intent);
layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
TabHost tabHost = getTabHost();
TabHost.TabSpec tab1spec = tabHost.newTabSpec("tabOneSpec");
ImageView imgView = new ImageView(this);
imgView.setBackgroundResource(R.drawable.subject);
tab1spec.setIndicator("Subject", imgView.getBackground());
tab1spec.setContent(new TabContentLayout());
TabHost.TabSpec tab2spec = tabHost.newTabSpec("tabTwoSpec");
tab2spec.setContent(new TabContentLayout());
ImageView imgView1 = new ImageView(this);
imgView1.setBackgroundResource(R.drawable.chapter);
tab2spec.setIndicator("Chapter", imgView1.getBackground());
tabHost.addTab(tab1spec);
tabHost.addTab(tab2spec);
}
private class TabContentLayout implements TabHost.TabContentFactory {
@Override
public View createTabContent(String tag) {
View view = null;
if(tag.equals("tabOneSpec"))
{
try
{
//static final String[] FRUITS = new String[] { "Apple", "Avocado", "Banana",
// "Blueberry", "Coconut", "Durian", "Guava", "Kiwifruit",
//"Jackfruit", "Mango", "Olive", "Pear", "Sugar-apple" };
view = (LinearLayout) layoutInflater.inflate(R.layout.subjecttabview, null);
//setListAdapter(new ArrayAdapter<String>(this, R.layout.subjecttabview,FRUITS));
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(tag.equals("tabTwoSpec"))
{
try
{
view = (LinearLayout) layoutInflater.inflate(R.layout.chaptertabview, null);
}
catch(Exception e)
{
e.printStackTrace();
}
}
return view;
}
}
はどのようにあなただけのリストビューを膨らませるか、プログラム的に作成して、ルートであるように思わビュー(のLinearLayout)に追加することができ、このTabActivity
http://stackoverflow.com/questions/4492162/android-listview-inside-tab-layout-inside -dialog-cant-get-scroll-bars-to-show-uこのリンクを参照してください... – Prem
このチュートリアルも参照してください... http://joshclemm.com/blog/?p = 59 – Prem
TabActivityを使用しないことをお勧めします。その非推奨の –