Questions tagged [viewgroup]

ViewGroup is a subclass of the Android View class(parent of all Android graphical widgets) which can contain child views.

ViewGroup is the base class for all Android layouts and views containers. This class is designed to be extended so the user can implement his own layout(which arranges the children following the desired logic, one not covered by the standards layouts) or a new view container. More information about the ViewGroup class can be found at the links below:

503 questions
5
votes
1 answer

What is the typical layout structure of an Android settings activity?

A great example of the kind of Activity I'm trying to create is the gmail app settings Activity. It lists all the customizable settings vertically with horizontal rules between each setting. There are variety of fields that usually look identical.…
objectivesea
  • 597
  • 1
  • 6
  • 22
5
votes
1 answer

ViewGroup match_parent inside wrap_content

There is one LinearLayout with wrap_content layout parameters. I have several views inside it with the match_parent parameter. Let's take a look. Case 1:
5
votes
0 answers

setAlpha not working on ViewGroup instance

setAlpha has no effect on ViewGroup instances in API levels 14(ICS)-19(KitKat) even though it was introduced in API level 11. Any ideas why? I've even tried using the support library but that doesn't work either. Example: LayoutInflater…
olfek
  • 3,210
  • 4
  • 33
  • 49
5
votes
1 answer

Custom ViewGroup with children inserted at specific spot

I have several Activities in my Android app that have the same basic structure, and I'm trying to make my layouts DRY. The duplicated code looks like the below. It contains a scrollable area with a footer that has "Back" and "Dashboard" links. …
pbristow
  • 1,997
  • 4
  • 26
  • 46
5
votes
8 answers

Add and remove a TextView dynamically in Android

I have set up a FrameLayout which has a TextView on top of a ListView. Now, in the MainActivity, after executing some code, I check whether the ListView is empty. If it is, I display the TextView, if not, I remove the TextView. The code is as…
Born Again
  • 2,139
  • 4
  • 25
  • 27
5
votes
1 answer

Placing a Drawable object in a view on a layout in an Android fragment

I think the title covers it :) I have a drawable object that fetches .png photo which I can manipulate with gestures. I also have a xml layout with a background image that is supposed to be behind this drawable object. Everything happens in a…
3mpetri
  • 599
  • 1
  • 9
  • 26
5
votes
1 answer

Building a zoom-able / pan-able container

I am trying to make a ViewGroup which supports panning and zooming of its contents. All I could find online was ideas and implementations to do so in an ImageView, but never a container. I want to display a map, and on top of it I want to display…
SoManyGoblins
  • 5,605
  • 8
  • 45
  • 65
4
votes
0 answers

Issue in a Custom ViewGroup when refreshing ListViews

first, i've created a repo on gitHub with a sample project with my bug in it : https://github.com/renaudfavier/SampleBug I've difficulties with my listViews in my customViewGroups : i simulate an assynk data query, then i'm tring to fill my…
Renaud Favier
  • 391
  • 6
  • 20
4
votes
0 answers

Children of my custom layout won't re-layout and re-measure correctly

I have implemented a custom layout that extends ViewGroup. In its onLayout() method, I make a loop on all my children : I add them to the layout, measure them and then layout them. It works just fine. But now I want my children to have dynamic…
Guillaume
  • 1,051
  • 1
  • 11
  • 15
4
votes
1 answer

Android: using MotionEvent to do drag and drop positioning of Views in a custom ViewGroup

I am having trouble positioning view elements on a custom ViewGroup that I have created, specifically in drag-and-drop situations. I am targeting Android 2.2 and up, so I can't really use the drag-and-drop API that came into existence in Android…
David
  • 1,847
  • 4
  • 26
  • 35
4
votes
1 answer

Unable to Find the topmost view using View.rootView

I have the following View structure in my activity: Relative Layout (id = 1) Relative Layout (id = 104) TextView (id = 200) Now when TextView is touched, I want to get the topmost relative layout's id (i.e. id = 1) I'm using…
4
votes
2 answers

Compound Controls forwarding State

Does anyone know what the appropriate mechanism is when creating a custom compound control to apply state changes from the container down to all the children? It would seem to me there should be a straightforward way to set up a ViewGroup to…
devunwired
  • 62,780
  • 12
  • 127
  • 139
4
votes
3 answers

Nine patch on a custom viewgroup

I made a nine-patch, and a custom viewgroup, then I made the background of that viewgroup to be the nine-patch. The problem is: The nine-patch is ignoring the "content area" settings. So: How I use a nine-patch properly in a custom view? OR: How I…
speeder
  • 6,197
  • 5
  • 34
  • 51
4
votes
3 answers

Prevent parent from getting touch events only for certain views?

I have a ScrollView and linear layout inside it. Inside the linear layout i have multiple views. One of the multiple views (DrawView lets say)is used to draw stuff so i have to override onTouchEvent of that method and draw things. Currently when i…
Dishonered
  • 8,449
  • 9
  • 37
  • 50
4
votes
2 answers

ConstraintLayout with Barriers; How to constraint to bottom / top of barrier depending on size

I am trying out the new Barrier feature in the 1.1.0-beta1. It works as expected however there is this use-case I cant seem to figure or (or is possible ConstraintLayout at all?) What I am trying to accomplish is: I have a imageview to the left, and…
urSus
  • 12,492
  • 12
  • 69
  • 89