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

Custom View with two TextViews

I want to create a custom view with 2 TextViews, with possibility change text and text appearances from xml. This view should have two state - normal and selected (TextViews style should be different for each state). I need some example for it.
waldemar
  • 655
  • 2
  • 10
  • 24
2
votes
0 answers

Android ID of ViewGroup displayed twice

I want to log the ID of a particular child View inside RelativeLayout. I used the below code to get that. But the ID is logged twice. Code: ViewGroup parentView = (ViewGroup) v.findViewById(R.id.category_layout); View childView; for(int i = 0; i <…
jobin
  • 1,489
  • 5
  • 27
  • 52
2
votes
1 answer

Save and Load layouts across different activities

I am in the process of creating an app with the following functionality. The Main activity is a Tabbed activity with three fragments. The middle fragment consists of a ListView. When you select the listView item it will allow you to do one of two…
srtmonkey
  • 85
  • 9
2
votes
3 answers

Android Custom text View To hold images and text

I have to show text and images exactly as TextView holds. spannable object can be used but the problem is images are being downloaded from server at run time and have to display placeholder till images are downloaded.. So I am thinking of creating…
Naveed Ali
  • 2,609
  • 1
  • 22
  • 37
2
votes
1 answer

android: measureChildWithMargins returns different results than view.measure

I'm extending a ViewGroup in Android. Currently, just for test, I add only 1 child view to this view group - a TextView instantiated via code. in the ViewGroup's onMeasure(), when I call child.measure(), the child measures its height as the entire…
user884248
  • 2,134
  • 3
  • 32
  • 57
2
votes
1 answer

setMargins method is not working on custom ViewGroup

I am working on a project where my portion of work is to create a sliding layout on main screen which will partially appear at bottom when the app will start and we can scroll that layout. And then I have to add child views inside of it which will…
Dhrumil Patel
  • 544
  • 6
  • 16
2
votes
1 answer

Android onInterceptTouchEvent, get childs in ViewGroup

I have a layout(like board) like this that contains cells(buttons) | A | B | C | D | ----------------- | E | F | G | H | ----------------- | I | J | K | L | ----------------- | X | Y | Z | W | I'm adding Cells programmatically, they contains…
Lazy
  • 1,807
  • 4
  • 29
  • 49
2
votes
1 answer

Ondraw method not calling in custom view

I am making custom view using custom ViewGroup and custom View in Android. public class Custom_ViewGroup extends ViewGroup { public Custom_ViewGroup(Context context) { super(context); addView(new OwnView(context)); } public…
Akashsingla19
  • 690
  • 2
  • 8
  • 18
2
votes
1 answer

Android adding multiple views to viewgroup

I have a simple question. I have an arrayList of views I want to add to a ViewGroup. I currently am iterating through them with a for loop and adding them individually. ViewGroup commentList = (ViewGroup) this.findViewById(R.id.comment_list); for…
uesports135
  • 1,083
  • 2
  • 16
  • 25
2
votes
0 answers

How do I redraw multiple child views at the same time?

I have an Android game with a GridLayout that contains a custom ImageView in each of its cells. At certain points in this game I want to redraw several of these ImageViews at the same time (not sequentially). If I call invalidate() on the parent…
Chamatake-san
  • 551
  • 3
  • 10
2
votes
1 answer

Android: Putting a border around multiple views

I am trying to figure out how to put a border around multiple views for an android app I'm working on. It seems like it should be very simple but I can't seem to figure it out. I have the following XML file saved in my drawable folder:
DerStrom8
  • 1,311
  • 2
  • 23
  • 45
2
votes
3 answers

How to make single choice button in android?

I am a newbie of android programming and trying to make a single choice button group. For example, There are 3 buttons in my application and when one button is clicked, the others should be unclicked and uncolored. How can I make this in effective…
2
votes
1 answer

Get "getText()" from child of type TextView within a custom ViewGroup at runtime

How is it possible to get "getText()" from child of type TextView within a custom ViewGroup at runtime?
Ajay
  • 1,255
  • 1
  • 17
  • 30
2
votes
0 answers

Convert touch in ViewGroup coordinates to touch in child View coordinates

In an App I am working on, I have a custom ViewGroup with some custom child Views. When I get a touch in this custom ViewGroup I would like to convert the coordinates of this touch to coordinates with respect to one of these child Views. Is there…
Zero
  • 1,864
  • 3
  • 21
  • 39
2
votes
1 answer

How to do Android Accessibility for custom viewgroups

I have a CustomViewGroup that extends from a ViewGroup. In it I have 2 text views and 3, 4 different buttons that I inflate from different XML files. My problem is that it does not seem to be accessible. What do I need to do at my end to see…
user3547028
  • 149
  • 2
  • 8