A ViewGroup is a special view that can contain other views, called children. The view group is the base class for layouts and views containers
Questions tagged [android-viewgroup]
223 questions
2
votes
1 answer
Send a view to back in Relative Layout
I am having so many views to in a relative layout which is able to zoom and rotate. what I am trying to achieve is, when I long click a view it should able to send that particular view to last .
what I do is
private void moveToBack(View…

DKV
- 1,767
- 3
- 28
- 49
2
votes
1 answer
Rotating while PopupMenu is showing, gets android.view.WindowLeaked
I have created a simple custom layout by extending ViewGroup. I create a Button and a PopupMenu on init(). If the button gets pressed, the PopupMenu gets shown. The problem is that, when the PopupMenu is showing, if I rotate the device, I get the…

Damn Vegetables
- 11,484
- 13
- 80
- 135
2
votes
3 answers
Setting layout weight to dynamically added view is not working in Android
I am developing an Android App. In my app, I am adding view dynamically and setting its weight in code as well. But it is not working.
This is my XML for container of dynamic views:
.
.
.

Wai Yan Hein
- 13,651
- 35
- 180
- 372
2
votes
0 answers
Android touch event dispatching from parent to child
I have a parent Viewgroup with a child View inside of it. I'm am noticing some behavior during touch events that differs from my mental model of how touch events are dispatched.
Viewgroup A takes up the full screen and View B is programmatically…

neonDion
- 2,278
- 2
- 20
- 39
2
votes
1 answer
Is it possible create view without xml in Android?
I am trying to create a custom view without xml
public class MyView extends ViewGroup {
public MyView (Context context) {
super(context);
setBackgroundColor(0xffff0000);
RelativeLayout base = new…

CL So
- 3,647
- 10
- 51
- 95
2
votes
0 answers
Put View Into Circular Layout Corner Android
I am made a semi circle custom layout. In which i want to put the my view into the outer surface of the semi circle. but it i not showing exactly i want.
I the below code I have override the OnLayout method of view group.
I have posted my code…

Umesh Saraswat
- 560
- 1
- 8
- 22
2
votes
1 answer
Casting RadioButton to ViewGroup
I am receiving a classcastingexception that states RadioButton cannot be cast to ViewGroup when I transition from an activity to a fragment by clicking a RadioButton. Any suggestions, please and thanks?
radioFeatures selected
11-20 12:50:08.794 …

JohnWilliams
- 139
- 1
- 13
2
votes
2 answers
Render content of ViewGroup twice
Im trying to create a sort of HUD overlay for Google Cardboard.
The HUD needs to be duplicated (one for each eye). A simplistic solution would be to manually copy all the XML elements into another view but giving them different names. This feels…

Richard
- 14,427
- 9
- 57
- 85
2
votes
0 answers
Cover Half Width of Parent in ViewGroup
I have a ViewGroup (lets call this A) in which a child is added. I want the A to be half the width of the parent.
Now in onMeasure I am setting the width to half of the parent size which comes in widthMeasureSpec but the problem I am facing is that…

Farooq Arshed
- 1,984
- 2
- 17
- 26
2
votes
0 answers
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 various post in SO, it has been suggested that get the…

Android
- 3,828
- 9
- 46
- 79
2
votes
0 answers
ViewPager in scrollview stops parent scrollview scroll effect - Android
In my android application, there is a ViewPager inside ScrollView, but Scrollview doesn't scroll and viewpager content is not displayed properly. I referred many posts but not getting any solution. I referred this link and many other posts. Please…

Zankhna
- 4,570
- 9
- 62
- 103
2
votes
0 answers
Repositioning child Views in onSizeChanged of the parent ViewGroup
I have added 3 custom views (SmallTile.java) to another custom view (MyView.java; it is based on the deprecated AbsoluteLayout - but I plan to change the base class later).
I am trying to position the 3 children by the following code in the…

Alexander Farber
- 21,519
- 75
- 241
- 416
2
votes
1 answer
Clipboard manager not opening for long press event of EditText,WebView
In one of my application i have WebView implemented to load some data from url. Everything is working perfect.
But whenever i am trying to long press and select the text of WebView an application gets crashed and throws error as below:
Even it…

GrIsHu
- 29,068
- 10
- 64
- 102
1
vote
1 answer
Android - IllegalStateException: Content has view with id attribute 'android.R.id.list_container' that is not a ViewGroup class
migrated an old project to AndroidX recently, and i'm struggling with implementing settings fragment.
Basically I tried to add a settings fragment as an example with some basic preferences. I even used the studio settings activity sample code but…

Or Bitton
- 64
- 4
1
vote
0 answers
Is it better to change visibility of a view after checking if the same view already has the desirable visibility or is it better to directly change it
I am creating an Android app where I need to change the visibility of a view depending on what selection is made by the user is Radio button section.
Let's consider a scenario where if 'A' is selected, the view 'v' need to be visible but if 'B' or…

Prateek no rules
- 29
- 3