Group
Note: This library does not have Kotlin reference docs, but you can
call the Java API from Kotlin source code. To learn more, see Kotlin's
interop documentation .
public
class
Group
extends View
java.lang.Object
↳
View
↳
androidx.constraintlayout.widget.Group
Added in 1.1
This class controls the visibility of a set of referenced widgets.
Widgets are referenced by being added to a comma separated list of ids, e.g:
<androidx.constraintlayout.widget.Group
android:id="@+id/group"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="button4,button9" />
The visibility of the group will be applied to the referenced widgets.
It's a convenient way to easily hide/show a set of widgets without having to maintain this set
programmatically.
Multiple groups
Multiple groups can reference the same widgets -- in that case, the XML declaration order will
define the final visibility state (the group declared last will have the last word).
Summary
Public constructors
Group (Context context)
Group (Context context, AttributeSet attrs)
Group (Context context, AttributeSet attrs, int defStyleAttr)
Inherited methods
From class
java.lang.Object
Object
clone()
boolean
equals(Object arg0)
void
finalize()
final
Class<?>
getClass()
int
hashCode()
final
void
notify()
final
void
notifyAll()
String
toString()
final
void
wait(long arg0, int arg1)
final
void
wait(long arg0)
final
void
wait()
Public constructors
Group
public Group (Context context)
Parameters
context
Context
Group
public Group (Context context,
AttributeSet attrs)
Parameters
context
Context
attrs
AttributeSet
Group
public Group (Context context,
AttributeSet attrs,
int defStyleAttr)
Parameters
context
Context
attrs
AttributeSet
defStyleAttr
int
Public methods
addView
public void addView (View view)
Add a view to the helper. The referenced view need to be a child of the helper's parent.
The view also need to have its id set in order to be added.
getReferencedIds
public int[] getReferencedIds ()
Helpers typically reference a collection of ids
Returns
int[]
ids referenced
public void loadParameters (ConstraintSet.Constraint constraint,
HelperWidget child,
ConstraintLayout.LayoutParams layoutParams,
mapIdToWidget)
Parameters
constraint
ConstraintSet.Constraint
child
HelperWidget
layoutParams
ConstraintLayout.LayoutParams
mapIdToWidget
removeView
public void removeView (View view)
Remove a given view from the helper.
public void resolveRtl (ConstraintWidget widget,
boolean isRtl)
Parameters
widget
ConstraintWidget
isRtl
boolean
setReferencedIds
public void setReferencedIds (int[] ids)
Helpers typically reference a collection of ids
Returns
void
ids referenced
updatePostConstraints
public void updatePostConstraints (ConstraintLayout constainer)
Parameters
constainer
ConstraintLayout
public void updatePreLayout (ConstraintWidgetContainer container,
Helper helper,
map)
Parameters
container
ConstraintWidgetContainer
helper
Helper
map
Protected methods
protected View[] getViews (ConstraintLayout layout)
Parameters
layout
ConstraintLayout