Я использую Tabhost, где я хочу установить фоновое изображение. Но после установки, он приходит как этотКак правильно выравнивать фоновое изображение для TabHost?
! [Введите описание изображения здесь] [1]
Как я могу установить его полностью? Ниже приведен код:
/* Tabs */
Bundle bundle = getIntent().getExtras();
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
Intent intent;
// First Activity
intent = new Intent().setClass(this, InfoListView.class);
//spec = tabHost.newTabSpec("some_things").setIndicator("Info").setContent(intent);
spec = tabHost.newTabSpec("top_things").setIndicator("Info",getResources().getDrawable(R.drawable.tabicon)).setContent(intent);
tabHost.addTab(spec);
// Second Activity
intent = new Intent().setClass(this, LogListView.class);
/*mContext = getApplicationContext();
TextView mTv = new TextView(mContext);
mTv.setText("Sync Log");
mTv.setBackgroundDrawable(mContext.getResources.getDrawable(R.drawable.tabicon));
spec = tabHost.newTabSpec("top_things").setIndicator(mTv).setContent(intent);*/
spec = tabHost.newTabSpec("top_things").setIndicator("Sync Log", getResources().getDrawable(R.drawable.tabicon)).setContent(intent);
tabHost.addTab(spec);
tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 95;
tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 95;
/* Вкладки заканчивается */
XML
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/title" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="0dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
<View
android:id="@+id/separator"
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_below="@android:id/tabs" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/btnSend"
android:layout_below="@+id/separator"
android:paddingBottom="45dip" >
<!-- Scrollview for message data -->
<ScrollView
android:id="@+id/formTab"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
<LinearLayout
android:id="@+id/formLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="5dip" />
</LinearLayout>
</ScrollView>
</FrameLayout>
</RelativeLayout>
</TabHost>
решена проблема ур? –
Да, он решил. Мне пришлось использовать Text View, а затем setBackground для него – user45678
ok nice. если вы решили это самостоятельно. отправьте свой ответ, чтобы, если у кого-то была такая же проблема. возьмите справку из вашего ответа. –