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
2
votes
1 answer

Android - NullPointerException using ViewGroup

When I relocate from one Activity to another using just simple TextView - it works. piece of code: private RMProject currentProject; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); …
Nikolas
  • 2,322
  • 9
  • 33
  • 55
2
votes
1 answer

ViewGroup child heights measure 0 when parent set to WRAP_CONTENT

I am creating a custom ViewGroup. If I add my custom ViewGroup to a layout without specifying an LayoutParams (as shown below), it displays correctly: ... MyCustomViewGroup myViewGroup = new…
Sound Conception
  • 5,263
  • 5
  • 30
  • 47
2
votes
3 answers

Disable touch event programmatically in viewgroup

I have an application in which i set some images at fix angles.At angle between 270 to 90 angle ,i hide the images by using invisible.but still its touch event working.obviously because images are there.i want to programmatically disable the touch…
gbl
  • 178
  • 2
  • 12
2
votes
0 answers

How to set Custom ViewGroup 's height "wrap_content"(an Auto wrap layout)

I want a layout which can automatic change line,so I write a viewGroup to achieve it.But although I set attribute "wrap_content",the AutomaticWrapLayout's height is more than the views of child and it's a whole screen.And on the top of it is a blank…
Marshal Chen
  • 1,985
  • 4
  • 24
  • 35
2
votes
0 answers

Grouping Views without placing them within a ViewGroup

Are there any tips for cleaning up code that must address many views at once without placing all of the views within some sort of ViewGroup and hence adding layout complexity? Nesting layouts in Android is costly for performance, but sometimes it…
Daniel Smith
  • 8,561
  • 3
  • 35
  • 58
2
votes
2 answers

A column could offset some distance down when scroll up and down in StaggeredGridView (PinterestListView)

I have used StaggeredGridView to show list items like Pintrest list view. This is the library link. But, second column going down while scrolling up and down. Original - After scrolling -
Santhosh
  • 1,962
  • 2
  • 16
  • 23
2
votes
3 answers

Is it possible to bring ViewGroups items in front of ViewGroups siblings?

I'm not sure if my question is understandable. I have an Image and a ViewGroup in my layout. The ViewGroup is comparable with a GridView, where I have items, that I can drag and drop. Now I'm interested in dragging the items of my ViewGroup over…
androider
  • 21
  • 3
2
votes
1 answer

Android - do ViewGroup onDraw need to iterate through child view and call onDraw explicitly?

I have spent the whole day debugging various ways to add custom ViewGroup into another custom ViewGroup and nearly went crazy because none of them works, and there is no official documentation or sample that shows how it can be done... Basically, I…
Zennichimaro
  • 5,236
  • 6
  • 54
  • 78
2
votes
0 answers

Custom Compound View in XML with Default Layout Parameters

Okay, so I'm trying to create a few reusable components. Basically, we have a compound layout that consists of: -- Header -- Description -- (any number of controls) -- Footer So I have a custom ViewGroup that handles adding the header and footer…
Kevin Coppock
  • 133,643
  • 45
  • 263
  • 274
2
votes
1 answer

Android: parent Viewgroup ontouch being ignored in favour of child view onclick

I am pretty certain I cant find a 100% appropriate solution for this, but I intend to ask this anyway given that it is giving me a headache trying to figure it out. For various reasons, I have a Scrollview (A) containing a FrameLayout (B) which has…
SKato
  • 95
  • 6
  • 15
2
votes
0 answers

Embed activity of application A inside application B's viewgroup in android

My requirement is as follows: I have two of my application, one is Application A and Application B. Now I want them to work individually as well as mutually We can assume this is the scenario which I need(assumed): Application A has activity…
skygeek
  • 1,548
  • 11
  • 24
2
votes
1 answer

How to remove View in Android?

I have two Buttons which is in main layout. If Add Button is clicked it has to add EditText dynamically(Using Inflater). This part is working. If Remove Button is clicked it has to remove those EditText with last in first out.But I don't know how…
2
votes
1 answer

Do more views mean worse performance in a ViewGroup?

I have a ViewGroup gallery in my app, and every child view is as large as the parent. This means that the parent can only show one child view at a time. However, outside the screen there may be 10 or 20 other child views that are still in this…
2
votes
2 answers

Should a custom View inside a custom ViewGroup use onDraw() or layout()?

At first, I created a custom view that drew itself by overriding the onDraw() method. This turned out to be impractical because of the large amount of views I needed to create. So I've created a custom ViewGroup that draws each of it's childs with…
BBB
  • 615
  • 3
  • 12
  • 26
2
votes
1 answer

Selector is applying change to all views instead of clicked view

I'm working on adding an onClick highlight to a view in a drag and drop grid in Android. The project is on GitHub (the dev branch contains the code that is using the selector). The problem I am having is in the adapter when I set the onClick…
Luke
  • 1,069
  • 18
  • 28