Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8425635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T04:19:34+00:00 2026-06-10T04:19:34+00:00

Hello I am beginner to the android development. I want to create a tab

  • 0

Hello I am beginner to the android development. I want to create a tab structure.Where i want every tab to have icon. When i am specifying icon through xml it does reflect in tab.But icon is not occupying full space.
Please help me with this.
here is my tab xml

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#000000">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >

        <TabWidget
                     android:id="@android:id/tabs"
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content" 
                     android:layout_alignParentBottom= "true"
                     />
        <FrameLayout
                     android:id="@android:id/tabcontent"
                     android:layout_width="fill_parent"
                     android:layout_height="fill_parent"
                     android:layout_above= "@android:id/tabs"
                     android:padding="5dp" />
    </RelativeLayout>
</TabHost>

Following is my xml which i am using for tab to have icon.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/home" android:state_selected="true"/>

<item android:drawable="@drawable/homefade"/>

</selector>

and this is the java code which i am using to apply icon.

    TabHost tabHost = (TabHost)findViewById(android.R.id.tabhost);

    tabHost.addTab(tabHost.newTabSpec(HOME_TAB).setIndicator("", getResources().getDrawable(R.drawable.tab_home_config)).setContent(
            new Intent(this, HomeActivity.class)));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T04:19:35+00:00Added an answer on June 10, 2026 at 4:19 am

    I figured it out..
    Need to set padding to zero that’s it.

    for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++)
    {
    tabHost.getTabWidget().getChildAt(i).setPadding(0,0,0,0);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello bash beginner question. I want to look through multiple files, find the lines
Hello I'm a Django Beginner. I have a calendar that I want to be
Hi this is ROR beginner's question. I have creat controller.rb and view hello.rhtml following
hello i am a beginner in objective-c i have a nsstring like this Select
Hello friends i am a total beginner in c#. I want to read numbers
I am beginner for WCF technology. So I create a simple wcf service hello
I'm a complete beginner in JS, so pls have patience :) my.hello = function
I am a beginner in Android programming. I was going through the official tutorial
Hello I am a lua beginner and am trying to loop through a CSV
Hello I want to make simple shopping cart. I am a beginner in programming.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.