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
3
votes
3 answers

Is it possible to set content view of a single view group within the code?

I want to know whether it is possible to use an xml layout file to define the content of a view dynamically from within the code. When we start an activity we pass it the xml layout to use with the method call setContentView(R.layout.main); but is…
Caleb
  • 524
  • 5
  • 18
3
votes
1 answer

Tutorial on creating custom layouts for Android?

I'm at my wits end trying to figure this out and hope there is someone out there who has a solution. I want to create a custom layout for an Android App. This should theoretically be straight forward enough, but I can find no useful information on…
Paul Blaine
  • 435
  • 2
  • 6
  • 9
3
votes
0 answers

Android ViewGroup.removeView() doesn't work

I have created a small "widget" in my project by extending a ViewGroup. In that widget I want to add and remove buttons (ImageView's). It was easy to create the widget and adding buttons worked fine but sometimes when I want to remove a button I…
t791
  • 31
  • 1
  • 3
3
votes
7 answers

Android -- Hiding Views

Okay, so I've done some looking around and I see how you are SUPPOSED to do it, but for me, it is just not working. I need to be able to set the alpha of a RelativeLayout both in XML and in code. For my XML, I have the following
user131441
3
votes
3 answers

Android Fragment what container is it in onCreateView() method

I wonder what is container parameter in onCreateView(), cause when i inflate view to that container it make me wonder what viewGroup is this,is it a viewGroup from the activity that we will add a fragment to ? if it is true then why we need to…
Tú Anh Dư
  • 135
  • 1
  • 10
3
votes
1 answer

what's the difference between view and viewgroup for the method onMeasure()?

I am learning a custom component, and I find some difference in the view and viewgroup for the method onMeasure().For example, someone calls super.onMeasure, someone uses setMeasuredDimension at the end. Where is a difference? And measureChildren()…
Curry Cao
  • 31
  • 2
3
votes
1 answer

Android cannot add children to a custom Layout (inherit from ViewGroup)

hi I'm pretty new to android developing and I'm trying to create my own custom layout: public class EqLayout extends ViewGroup { public EqLayout(Context context){ super(context); } public EqLayout(Context context, AttributeSet attrs){ …
Levenlol
  • 305
  • 5
  • 17
3
votes
1 answer

toolbar.getChildCount() returns 0

I am trying to change the font of my application title. In order to do this, I decided to traverse through the toolbar, find the title TextView and then set the typeface. Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); TextView title…
3
votes
0 answers

rewrite ViewGroup onMeasure, child match_parent not work

I have a custom Relativelayout with custom onMeasure method. code as below. @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int height =…
Cao Dongping
  • 969
  • 1
  • 12
  • 29
3
votes
2 answers

Force ViewGroup's children move to next line if they exceed the device width

I want to have a view group which may has some views which are positioned horizontally next together. The problem with my code is, everything is fine but when children count is getting greater, all children positioned horizontally together and…
Alex
  • 1,623
  • 1
  • 24
  • 48
3
votes
0 answers

Custom Layout Manager using predefined and developer-defined child view(s)

Revised Question When one looks online in tutorials, or by Google IO presentations, there are always just 2 kinds of UI customizations that one can do (but there are several implementations of doing each type). These customizations are: Creating a…
3
votes
0 answers

TextView consumes onTouchEvent

For a custom layout, I need to monitor TouchEvents using the onInterceptTouchEvent method of the ViewGroup. I have the following layout inside a ViewGroup. ... ... …
3
votes
1 answer

view and viewgroup android

I know java basics and I am learning Android development now. I have learnt that there are two central android classes for the ui, View and ViewGroup. I want you to correct me wherever I am wrong. ViewGroup is a subclass of View and holds View…
garfield
  • 89
  • 7
3
votes
3 answers

How to create custom gridview (Like matrix structure ) in Android

I want to create a matrix like gridview say 10x20 matrix we want to specify the number of rows and column of the View ie 10x20 if the screen is low it should scroll to horizontally and vertically for example the image below describe the Matrix…
kukku
  • 489
  • 5
  • 17
3
votes
1 answer

Scale animation - How to stop child view animation

I have a layout(parent view) and a textview(child view) inside this layout. Applying scale animation on parent view but when scale animation is applied to parent view its child view also scales.Is there any way to stop child from animation ?…
android.fryo
  • 1,469
  • 1
  • 14
  • 18