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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:47:29+00:00 2026-05-23T23:47:29+00:00

I want to make my layout for my first tab something like this: I

  • 0

I want to make my layout for my first tab something like this:

enter image description here

I have already asked a question similar to this. I am getting stuck on the formatting:
This is what my code looks like:

<?xml version="1.0" encoding="utf-8"?>
<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">
        <LinearLayout
            android:orientation="vertical"        
            android:layout_width="fill_parent"        
            android:layout_height="fill_parent"        
            android:padding="5dp">        
        <TabWidget
             android:id="@android:id/tabs"            
             android:layout_width="fill_parent"            
             android:layout_height="wrap_content" />        
        <FrameLayout            
            android:id="@android:id/tabcontent"            
            android:layout_width="fill_parent"            
            android:layout_height="fill_parent"            
            android:padding="5dp" /> 
            <RelativeLayout 
                android:orientation="vertical"                
                android:layout_width="fill_parent" 
                android:layout_height="wrap_content"    >            
                <ImageView
                    android:id="@+id/simpleMode"
                    android:layout_width="wrap_content"         
                    android:layout_height="wrap_content" 
                    android:padding = "5dip"
                    android:layout_alignParentLeft="true"           
                    android:src="@drawable/ic_tab_artists_grey" />  
                <TextView     
                    android:id="@+id/right_text"        
                    android:layout_width="fill_parent"        
                    android:layout_height="wrap_content"        
                    android:padding="5dip"        
                    android:layout_toRightOf="@+id/simpleMode"        
                    android:gravity="right"             
                    android:text="Description"        />                 
            </RelativeLayout>       
        </LinearLayout>
</TabHost>

My project runs but absolutely nothing shows up on the screen? Help is very much appreciated!!

Here is my activity class:
package com.joshi.remotedoc;

import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
import android.content.Intent;
import android.content.res.Resources;

public class Detailed_ModeActivity extends TabActivity {
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);    
        setContentView(R.layout.patientmode);    
        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, SimpleMode.class);
        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("simpleMode").setIndicator("simpleMode",
                res.getDrawable(R.drawable.ic_tab_artists_white))
                .setContent(intent);    
        tabHost.addTab(spec);
        // Do the same for the other tabs
        intent = new Intent().setClass(this, DetailedMode.class);
        spec = tabHost.newTabSpec("2ndtab").setIndicator("MySecondTab",                          res.getDrawable(R.drawable.something))                      .setContent(intent);
        // Initialize a TabSpec for each tab and add it to the TabHost
        spec = tabHost.newTabSpec("detailedMode").setIndicator("detailedMode",
                res.getDrawable(R.drawable.ic_tab_artists_grey))
                .setContent(intent);    
        tabHost.addTab(spec);
        tabHost.setCurrentTab(2);
}

    }
  • 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-23T23:47:30+00:00Added an answer on May 23, 2026 at 11:47 pm

    You need to properly define your layout, then you need to load your layout in the activity you are starting.

    http://developer.android.com/guide/topics/ui/declaring-layout.html

    First you create your XML

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent" 
                  android:layout_height="fill_parent" 
                  android:orientation="vertical" >
        <TextView android:id="@+id/text"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:text="Hello, I am a TextView" />
        <Button android:id="@+id/button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Hello, I am a Button" />
    </LinearLayout>
    

    Then you need to create the Java to load your XML in the oncreate method:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_layout);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

![enter image description here][1] I want to make a tab layout application, in which
I want to make first input have the width 100% and second + image
I want to make a layout with a rounded border. How can I apply
Layout is FreeDesign I want to make less space between JLabel and JFrame in
JSFIDDLE EXAMPLE BELOW I want to make the following CSS layout and currently im
What I want to achieve I'm trying to make a layout equal to the
I have style sheet with a class name changebackgroundcolor i want make change in
How can I have this other box display at the bottom of the first
First time I post a question, so here it goes. I want to push
This is my first question at stackoverflow :-). However, I've started to Android 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.