Note that there are some explanatory texts on larger screens.

plurals
  1. POi am not getting icon for customized tab
    primarykey
    data
    text
    <p>In my app i am using the customized tab. Here i am adding icons pro-grammatically to the image view. the images are adding correctly except to the first tab. please can anybody help me. Following is my code.</p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/tabsLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/tab_bg_selector" android:padding="2dip" android:gravity="center" android:orientation="vertical"&gt; &lt;ImageView android:id="@+id/tabicon" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;TextView android:id="@+id/tabsText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Title" android:textSize="12dip" android:textColor="@drawable/tab_text_selector" /&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>Java code</strong></p> <pre><code>public class CustomTabActivity extends Activity { private TabHost mTabHost; private void setupTabHost() { mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // construct the tabhost setContentView(R.layout.main); setupTabHost(); mTabHost.getTabWidget().setDividerDrawable(R.drawable.tab_divider); setupTab(new TextView(this), "Find Gifts",R.drawable.findgifts); setupTab(new TextView(this), "Tracked Items",R.drawable.items); setupTab(new TextView(this), "Preferences",R.drawable.preferences); } private void setupTab(final View view, final String tag,int drawable) { View tabview = createTabView(mTabHost.getContext(), tag, drawable); TabSpec setContent = mTabHost.newTabSpec(tag).setIndicator(tabview).setContent(new TabContentFactory() { public View createTabContent(String tag) { return view; } }); mTabHost.addTab(setContent); } private static View createTabView(final Context context, final String text,int drawable) { View view = LayoutInflater.from(context).inflate(R.layout.tabs_bg, null); ImageView tabicon = (ImageView) view.findViewById(R.id.tabicon); tabicon.setBackgroundResource(drawable); TextView tv = (TextView) view.findViewById(R.id.tabsText); tv.setText(text); return view; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload