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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:36:16+00:00 2026-05-28T07:36:16+00:00

I have a gridview in which there are two elements in each of its

  • 0

I have a gridview in which there are two elements in each of its items, the first is an image and the second is a title, the title is invisible in the launching of the application, but I have a button outside the grid view that when I click on it, I want to change the visibility of the titles of items to become visible, my problem is that I can not access each title of each item in the grid view. When I set the visibility of the titles (TextView) in the onClick method of the independent button in my activity, it changes the visibility ONLY for the FIRST item in the grid view!

This sketch represent my interface, so the titles are invisible in the beginning, but when i click on “SetVisibilityButton”, i want to set them to Visible :

    Image1    Image2      Image3
    Title1    Title2      Title3

    Image4    Image5      Image6
    Title4    Title5      Title6

    Image7    Image8      Image9
    Title7    Title8      Title9


    ----------------------------
    SetVisibilityButton
    ____________________________        

I set the grid view in my oncreate() activity :

    favorGrid = (GridView) findViewById(R.id.favorGrid);
    favorGrid.setAdapter(adapter);

In my ImageAdapter class, this is my getView() method :

          @Override
       public View getView(int position, View convertView, ViewGroup parent) 
       {
          View MyView = convertView;

           /*we define the view that will display on the grid*/

             //Inflate the layout
             LayoutInflater li = getLayoutInflater();
             MyView = li.inflate(R.layout.favor_item, null);

             // Add The Text!!!
             TextView tv = (TextView)MyView.findViewById(R.id.title);
             tv.setText(mTitles[position]);

             // Add The Image!!!           
             ImageView iv = (ImageView)MyView.findViewById(R.id.favor_item_image);
             iv.setImageResource(mThumbIds[position]);
          return MyView;
       }

To get the title textview from my main activity and set his visibility, I tried :

    TextView title = (TextView) findViewById(R.id.title);
    title.setVisibility(View.VISIBLE);

and tried :

     // gv is the gridview (R.id.gridview)
     TextView title = (TextView)gv.findViewById(R.id.title);
     title.setVisibility(View.VISIBLE);

and tried :

      LinearLayout layout = (LinearLayout) findViewById(R.id.gridLayout);
      TextView title = (TextView)layout.findViewById(R.id.title);
      title.setVisibility(View.VISIBLE);

But all these solutions set the visibility for only the first element in the grid view.

I spent a lot of time with this problem but I don’t yet found a solution, does anyone could help me to fix it please
thank you in advance

  • 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-28T07:36:17+00:00Added an answer on May 28, 2026 at 7:36 am

    This is simple:

    GridView mGridView (Your object instance)
    
    final int size = mGridView.getChildCount();
    for(int i = 0; i < size; i++) {
      ViewGroup gridChild = (ViewGroup) mGridView.getChildAt(i);
      int childSize = gridChild.getChildCount();
      for(int k = 0; k < childSize; k++) {
        if( gridChild.getChildAt(k) instanceof TextView ) {
          gridChild.getChildAt(k).setVisibility(View.GONE);
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview which will have Insert/Delete/Update. There are two kinds of exception
I have a Gridview in which i have two templatefields of dropdownlist. I bound
I have a GridView in which each row has a custom view. The grid
I have a GridView which allows users to enter data using a EmptyDataTemplate. There
I have GridView which I can select a row. I then have a button
I have a gridview which is databound, I want to dynamically add a row
I have a GridView which I am populating by calling a method to return
I have a GridView which is databound to an XML Datasource. For one of
Have a gridview control which will show X amount of rows. I want to
I have a gridview to which I have created an Insert Template in the

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.