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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:40:09+00:00 2026-05-28T05:40:09+00:00

EDIT: I solved #2 below by simply changing the background of the TextView’s parent

  • 0

EDIT: I solved #2 below by simply changing the background of the TextView’s parent ScrollView.

I’ve been googling all day, but just can’t seem to find the answer to this. This should be simple.

My activity contains a fragment that is made up of a Tabbed control (TabHost, TabWidgets, etc.). On each tab is a simple, scrolling TextView. The idea is to have a few tabs with different categories of text that the user can scroll through. I’ve been able to set up the tabs and such, but have 2 problems that I can’t seem to solve.

1) I can’t figure out how to change the contents of a tab’s TextView programmatically (from the Activity that owns the fragment). I’ve tried creating a FragmentManager inside my host activity, finding the fragment, casting the fragment to my fragment class, then calling a function inside the fragment class that is supposed to change the text. This function simply does this:

TextView textView = (TextView)tabHost.getTabWidget().getChildAt(tabNumber).findViewById(R.id.dashboard_fragment_4_textView);
    if(textView!=null) textView.setText(text);

This doesn’t work; textView always returns as null.

2) A layout issue, I believe. My TextView on each tab doesn’t fill the parent; it just wraps the text content. This is not a huge deal, but I want the entire screen area available to the TextView to have a particular background color. Maybe there’s a better way to handle this??? Like having the TextView’s background transparent, and then having something behind the TextView with the right color? I don’t know….I’m reaching.

Here’s the xml layout for each tab:

<TabHost   xmlns:android="http://schemas.android.com/apk/res/android" 
       android:id="@+id/tabHost"
       android:layout_width="match_parent" 
       android:layout_height="match_parent"
       >
<LinearLayout android:orientation="horizontal"
              android:layout_width="match_parent" 
              android:layout_height="match_parent">
    <TabWidget android:id="@android:id/tabs" 
               android:layout_height="match_parent" 
               android:layout_width="wrap_content"
               android:gravity="left"                   
               android:layout_weight="0" />
    <FrameLayout android:id="@android:id/tabcontent"
                 android:layout_height="match_parent" 
                 android:layout_width="0dp"
                 android:layout_weight="1">

        <ScrollView
            android:id="@+id/dashboard_fragment_4_scrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/dashboard_fragment_4_textView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/Linen"
                android:textColor="@color/Black"
                android:textSize="20dp"
                android:text="TextView" />

        </ScrollView>

    </FrameLayout>
</LinearLayout>

Thanks for any suggestions!!

Bryan

  • 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-28T05:40:09+00:00Added an answer on May 28, 2026 at 5:40 am

    Obviously, it should be tabs.getTabContentView() instead of tabHost.getTabWidget()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone
edit #2: Question solved halfways. Look below As a follow-up question, does anyone know
Edit: I have solved this by myself. See my answer below I have set
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
EDIT: Paul has solved this one below. Thanks! I'm trying to resample (upscale) a
EDIT: SOLVED! answer below first code box When i try to connect with a
Edit: Solved using the below suggestion of removing: echo '{results:'.json_encode($arr).'}'; and replacing with echo
Edit: I solved it somehow with PHP. Its so specific but I want to
Edit : Solved, there was a trigger with a loop on the table (read
Edit: Solved. Hi, I'm starting with Qt, I try to connect a slot to

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.