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 6920271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:07:34+00:00 2026-05-27T10:07:34+00:00

I set my minSdkVersion to 8 and targetSdkVersion also to 8, everything seems to

  • 0

I set my minSdkVersion to 8 and targetSdkVersion also to 8, everything seems to be okay except for one thing. My tab bar (custom tab bar) graphics have shrunk to about half their size. All the other graphics in the app seem fine. It’s probably worth noting that the tab bar graphics are the only graphics I size programmatically upon app launch. Here is a snippet from my setUpTabs() method:

public void setUpTabs()
{
    //Tab setup
    TabHost mTabHost = getTabHost();

    ListView pastTripsListView=(ListView)findViewById(R.id.pastTrips);
    //ListView settingsListView=(ListView)findViewById(R.id.settings);
    ListView upcomingTripsListView=(ListView)findViewById(R.id.upcomingTrips);

    pastTripsListView.setAdapter(pastTripsAdapter);
    pastTripsListView.setOnItemClickListener(pastTripsAdapter);

    upcomingTripsListView.setAdapter(upcomingTripsAdapter);
    upcomingTripsListView.setOnItemClickListener(upcomingTripsAdapter);

    mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator("").setContent(R.id.pastTrips));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator("").setContent(R.id.settings));
    mTabHost.addTab(mTabHost.newTabSpec("tab_test3").setIndicator("").setContent(R.id.upcomingTrips));

    mTabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 49;
    mTabHost.getTabWidget().getChildAt(1).getLayoutParams().height = 49;
    mTabHost.getTabWidget().getChildAt(2).getLayoutParams().height = 49;

    RelativeLayout tabLayoutLeft = (RelativeLayout) mTabHost.getTabWidget().getChildAt(0);
    tabLayoutLeft.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_indicator_left));

    RelativeLayout tabLayoutCenter = (RelativeLayout) mTabHost.getTabWidget().getChildAt(1);
    tabLayoutCenter.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_indicator_center));

    RelativeLayout tabLayoutRight = (RelativeLayout) mTabHost.getTabWidget().getChildAt(2);
    tabLayoutRight.setBackgroundDrawable(getResources().getDrawable(R.drawable.tab_indicator_right));

    mTabHost.setCurrentTab(2);
    //End Tab setup
}

Now, the 49 I’m setting for the height is in pixels or dip??? Could this be what’s causing the problem? Can I just set these tabs up in the xml file instead?

Also when I hover over the word “height” the intellisense tells me the following:

Information about how tall the view wants to be. Can be one of the constants FILL_PARENT (replaced by MATCH_PARENT , in API Level 8) or WRAP_CONTENT. or an exact size.

When I try MATCH_PARENT it says it can’t be resolved. Where can I get this?

Thanks a lot.

  • 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-05-27T10:07:34+00:00Added an answer on May 27, 2026 at 10:07 am

    I don’t this you should do this:

    mTabHost.getTabWidget().getChildAt(0).getLayoutParams().height = 49;
    

    And expect it to stick. AFAIK You should be doing:

    RelativeLayout.LayoutParams lp =  mTabHost.getTabWidget().getChildAt(0).getLayoutParams();
    lp.height = 49;
    mTabHost.getTabWidget().getChildAt(0).setLayoutParams(lp);
    

    Besides, you are setting the height to fixed pixels. You should always use dip if you want your widget to remain the same height in multiple screen resolutions. The conversion from dip to pixels is easy:

    final float scale = getResources().getDisplayMetrics().density;
    int pixels =  49 * scale + 0.5;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Android application with this lines in the manifest: <uses-sdk android:minSdkVersion=8 android:targetSdkVersion=13/>
I developed my app with minSdkVersion set to 3, targetSdkVersion set to 8. My
I have to set up 2 database for one application. I did & working
From everything I've seen on Stack Exchange and elsewhere, I have everything set up
Set Success page redirection in google checkout ? i have already set callback URL
my app is currently compatible with Cupcake and up. That is: minSdkVersion is set
I have an application that has numerous activities. I set this in the manifest:
What is the difference between targetSdkVersion set in the Manifest file and the Project
set in Appearance, overriden by theme(?) also i suspect this pref is newly introduced
Set up: I have a mainPanel with a tabbedPane on it, i have a

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.