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

All Questions

0 votes
1 answer
240 views

'void android.widget.LinearLayout.setVisibility(int)' on a null object reference when i want to display a LinearLayout

I have a problem with a button that modifies the visibility of a LinearLayout I always get the error java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.LinearLayout....
11itachikun's user avatar
0 votes
2 answers
491 views

How to set visibility GONE of a Linear Layout which is inside a scroll view and contains two TextViews inside?

The main layout is a Linear layout inside that a scroll view is there which contain sublayouts. Here is my layout [omitted everything except the specific layout (marked with red) as it will be very ...
s4surajverma's user avatar
1 vote
1 answer
40 views

does weight re-calculate when one of the children view changes its visibility to gone in run time code?

I have a linear layout with two linear layout as children. they have weights. sometimes that lower linera layout child is with visibility gone but then i would expect the upper child to be ...
Elad Benda's user avatar
  • 36.2k
2 votes
2 answers
3k views

Visibility of Gone takes still space of particular control in android?

I am using the LinearLayout and inside there's button I am making visibilty gone based on supported states. SupportedStatuses are true then making Button as Visible but SupprtedStatuse are false then ...
Swift's user avatar
  • 887
2 votes
0 answers
334 views

Setting the visibility for a linear layout(view group)

When I set setVisibility(View.GONE) or setVisibility(View.VISIBLE) for a linear layout it seems that it does not changes the visibility of the view(saying view group would be more accurate). At ...
Android's user avatar
  • 3,858
1 vote
1 answer
760 views

When I Change visibility of a linear layout and add to list all past items visibility will be changed

i have an android program that simulate chat. for it i use a list and items of list are in a XML file named activity_chat_conversation in this layout i have to linear layout that in each of them i ...
Yekta Mghani's user avatar
6 votes
5 answers
30k views

Hide and show layout based on conditions in Android

I am new to Android. I want to hide and show Linearlayout based on if else conditions. In my application I have taken 1 spinner. Based on selected spinner values I want my next layout hide or visible, ...
12345's user avatar
  • 143
2 votes
1 answer
3k views

LinearLayout and Visibility GONE issue

Alright, so I'm running into a rather odd problem. I think I'm doing this right, but something weird happens when I try to set the visibility to GONE on any of my linear layouts. Basically, what I'm ...
user2328381's user avatar
1 vote
2 answers
310 views

NPE when setting the visibility of a nested LinearLayout in a custom AlertDialog?

I'm trying to show a custom AlertDialog. I have a LinearLayout within the main LinearLayout that contains a few buttons. The buttons are only supposed to show at certain times, so I'm trying to set ...
rphello101's user avatar
  • 1,741
5 votes
1 answer
4k views

Does LinearLayout with visibility GONE consume zero resources?

I was thinking about how to implement an ImageView that shows an image and while I'm refreshing its content with a new image it shows a "Loading..." text with a circular ProgressBar on the right, so I'...
Gianni Costanzi's user avatar
0 votes
1 answer
3k views

Android - Collapsible LinearLayout with multiple items

I'm trying to make a list of LinearLayout become VISIBLE at a click on a "header" LinearLayout. <LinearLayout android:id="@+id/sample_title" ...> <TextView ... /> </LinearLayout>...
shkschneider's user avatar
  • 18.2k
1 vote
2 answers
999 views

options menu does not come up after back button press android

I have an android application where I want to display a LinearLayout when user clicks on options button(I am setting the linear layout's visibility to visible in onCreateOptionsMenu) and make it ...
Namratha's user avatar
  • 16.7k
2 votes
1 answer
2k views

One videoview blocked by another videoview

My activity layout is shown below. Basically I have a listview menu on the left and two videoviews that I switch between depending on which menu item the user clicks. <?xml version="1.0" encoding="...
yellavon's user avatar
  • 2,871
2 votes
1 answer
4k views

Android LinearLayout Visibility issues with Animation

I am trying to swap two LinearLayouts by setting their visibility properties to "VISIBLE" and "GONE" respectively. I am also using an animation while the layouts are being swapped. The animation ...
adityad's user avatar
  • 483