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

  • Home
  • SEARCH
  • 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 6148425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:16:42+00:00 2026-05-23T19:16:42+00:00

Simple question (I guess). I have this default google tutorial code for tabs: intent

  • 0

Simple question (I guess). I have this default google tutorial code for tabs:

    intent = new Intent().setClass(this, About.class);
    spec = tabHost.newTabSpec("albums").setIndicator("About")
                  .setContent(intent);
    tabHost.addTab(spec);
    for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
        tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 50;
    } 

And I was wondering – is it possible to change text position and (or) background just by adding lines of code to the existing piece, not starting everything over again? Thanks!

So yeah: TEXT POSITION and CUSTOM BACKGROUND (html color). How do I do it? Thanks!

P.S Please don’t start droping links to other tutorials, it’s kinda hard for me to understand those. :/

  • 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-23T19:16:43+00:00Added an answer on May 23, 2026 at 7:16 pm

    I found the code I was looking for. Here’s the full code of my Tabs.java activity:

    package com.xjcdi.name;
    
    import com.xjcdi.exploringvilnius.R;
    
    public class Tabs extends TabActivity implements OnTabChangeListener {
    
        TabHost tabHost;
    
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.tabs);
    
            tabHost = (TabHost)findViewById(android.R.id.tabhost);
            tabHost.setOnTabChangedListener(this);
    
            Resources res = getResources(); // Resource object to get drawables
            TabHost tabHost = getTabHost();  // The activity TabHost
            TabHost.TabSpec spec;  // Reusable TabSpec for each tab
            Intent intent;  // Reusable Intent for each tab
    
            // Create an Intent to launch an Activity for the tab (to be reused)
            intent = new Intent().setClass(this, Places.class);
    
            // Initialize a TabSpec for each tab and add it to the TabHost
            spec = tabHost.newTabSpec("artists").setIndicator("Places")
                          .setContent(intent);
            tabHost.addTab(spec);
            for (int i = 0; i < tabHost.getTabWidget().getTabCount(); i++) {
                tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 50;
            }
            for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
    
    
    
            // Do the same for the other tabs
            intent = new Intent().setClass(this, About.class);
            spec = tabHost.newTabSpec("albums").setIndicator("About")
                          .setContent(intent);
            tabHost.addTab(spec);
            for (int i = 1; i < tabHost.getTabWidget().getTabCount(); i++) {
                tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 50;
            }
    
            intent = new Intent().setClass(this, Artistai.class);
            spec = tabHost.newTabSpec("songs").setIndicator("Map")
                          .setContent(intent);
            tabHost.addTab(spec);
            for (int i = 2; i < tabHost.getTabWidget().getTabCount(); i++) {
                tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 50;
            }
    
            intent = new Intent().setClass(this, Map.class);
            spec = tabHost.newTabSpec("songs").setIndicator("History")
                          .setContent(intent);
            tabHost.addTab(spec);
            for (int i = 3; i < tabHost.getTabWidget().getTabCount(); i++) {
                tabHost.getTabWidget().getChildAt(i).getLayoutParams().height = 50;
            }
    
    
    
            tabHost.setCurrentTab(0);
        }
    
        @Override
        public void onTabChanged(String tabId) {
            // TODO Auto-generated method stub
            for(int i=0;i<tabHost.getTabWidget().getChildCount();i++)
            {
                tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#000000"));
            } 
    
            tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()).setBackgroundColor(Color.parseColor("#c1902d"));
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I guess this is just a simple question (I’m such a noob…) I have
This is a simple question i guess.... I have a panel that i can
I guess this is a quite simple (read: very simple) question, but I have
This is a very simple question. I have a script in the same folder
I'm hoping this is a rather simple question, but I'm pretty new to MVC
I guess this is a really simple question and, probably, one that has been
I have a very simple question (I guess!) I used to work with Scriptaculous
I am new to TDD and DDD and I have one simple question regarding
Pretty simple question (probably) but I guess since im new to python im not
Probably a simple question but one that eludes me nonetheless. I have a class:

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.