Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

0 votes
0 answers
41 views

Android - Why this TextView is moving its position after changing its visibility programmatically?

Initially both TextViews are visible and aligned correctly: After clicking the Button, I set both TextViews visibility to GONE. Second time I click on the Button, I set the visibility again to ...
xerez's user avatar
  • 69
2 votes
4 answers
2k views

Android: View Visibility set to View.VISIBLE but View is not Visible

In my app (general construction described below), I have a timer, which the user can start by clicking an in-app button. When the timer starts, a notification is shown. In the notification, there's a ...
Nitzan Daloomy's user avatar
1 vote
1 answer
260 views

What's good approach, InflateView/ removeView OR setting Visibility.GONE?

I've got a fragment with a view having a skeleton view on it. Skeleton/Shimmering view is shown only once when data is in the loading state and then it is hidden. I'm using that fragment in ViewPager2....
Usman Rana's user avatar
  • 2,122
0 votes
2 answers
39 views

inner recyclerview inside holder cuts cut

I have the following XML layout - <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/...
Alon Shlider's user avatar
  • 1,268
2 votes
1 answer
812 views

Detect if a view is added to layout or not

I'm using an OnLongClickListener to detect whether or not a button is being displayed in a layout or not. if the button is not in the layout, it must be added if the button is already present in the ...
dewie's user avatar
  • 99
1 vote
2 answers
163 views

Imagebutton is not visible in Oncreate and not clickable

I just want to add a onClick method in my Imagebutton, but the imagebutton is just not visible, but in my layout. My button somehow was visible, but my onclick method didn't work. For some reason the ...
Creesch 2.0's user avatar
0 votes
1 answer
887 views

How to make visible only one listitem at a time in recyclerview?

I am using RecyclerView and it has two TextViews; one for a question and one for an answer. Following is the view for reference. By default, I set the answer TextView to invisible to the user. Now if ...
Nilima 's user avatar
0 votes
1 answer
2k views

Changing visibility of a view from GONE to VISIBLE causes lag and slow

I'm getting stuck at this problem. I have an activity like attached image. by default, in the toolbar, display only layout1, then when user click on layout1, layout2 appear/gone. I'm using layout1....
Lý Lê's user avatar
  • 23
0 votes
0 answers
49 views

Layout and Toast not displaying

My MainActivity layout consists of 4 embedded LinearLayouts, all declared Visibility:GONE in the XML. The first layout contains just a TextView. I set this layout to VISIBLE, and then try to display ...
Robert Lewis's user avatar
  • 1,887
34 votes
3 answers
27k views

toggle visibility of chain group in constraint layout

In previous xml layout, I have multiple view groups with few elements inside. Hide each view group will also hide all of its child elements. Since I wanted to have flat structure and tried ...
Tixeon's user avatar
  • 930
0 votes
2 answers
146 views

View taking space after hiding

I made one TextView and set it's visibility to invisible. so it's working fine in terms of hiding but when the set the gravity to center for the remaining elements they leave a free space for that ...
James Smith's user avatar
0 votes
1 answer
1k views

android:visibility="gone" does not clear up the space on certain devices:

I have the following portion of layout in one of my layouts: ..... <LinearLayout android:id="@+id/llBottom" android:layout_width="match_parent" android:layout_height="...
Emil Adz's user avatar
  • 41k
0 votes
2 answers
2k views

Android - Hide button during an onClick action

I need to hide a button during an onClick action like this: public void onClick(View view) { switch (view.getId()){ case R.id.button1: Button button2 = (Button) ...
Villat's user avatar
  • 1,465
0 votes
2 answers
583 views

CardView background changing when changing visibility?

I have to show the CardView when taping the Tap to edit text TextView and tapping outside will hide the CardView. I have tried to switch CardView background to transparent and white for doing that and ...
Stella's user avatar
  • 1,817

15 30 50 per page