ArcLayout.LayoutParams
public class ArcLayout.LayoutParams extends ViewGroup.MarginLayoutParams
| java.lang.Object | |||
| ↳ | android.view.ViewGroup.LayoutParams | ||
| ↳ | android.view.ViewGroup.MarginLayoutParams | ||
| ↳ | androidx.wear.widget.ArcLayout.LayoutParams |
Layout parameters for a widget added to an arc. This allows each element to specify whether or not it should be rotated(around the center of the child) when drawn inside the arc. For example, when the child is put at the center-bottom of the arc, whether the parent layout is responsible to rotate it 180 degree to draw it upside down.
Note that the rotate parameter is ignored when drawing "Fullscreen" elements.
Summary
Constants |
|
|---|---|
static final int |
Align to the center of the parent ArcLayout. |
static final int |
Align to the inner edge of the parent ArcLayout. |
static final int |
Align to the outer edge of the parent ArcLayout. |
Public constructors |
|---|
LayoutParams(@NonNull ViewGroup.LayoutParams source)Copy constructor |
LayoutParams(@NonNull Context context, @Nullable AttributeSet attrs)Creates a new set of layout parameters. |
LayoutParams(int width, int height)Creates a new set of layout parameters with specified width and height |
Public methods |
|
|---|---|
int |
Gets how the widget is positioned vertically in the ArcLayout. |
float |
Returns the weight used for computing expansion. |
boolean |
Gets whether the widget shall be rotated by the ArcLayout container corresponding to its layout position angle |
void |
setRotated(boolean rotated)Sets whether the widget shall be rotated by the ArcLayout container corresponding to its layout position angle |
void |
setVerticalAlignment(int verticalAlignment)Sets how the widget is positioned vertically in the ArcLayout. |
void |
setWeight(float weight)Indicates how much of the extra space in the ArcLayout will be allocated to the view associated with these LayoutParams up to the limit specified by |
Inherited Constants |
||||||
|---|---|---|---|---|---|---|
|
Inherited fields |
||||||||
|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||
|
Constants
VERTICAL_ALIGN_CENTER
public static final int VERTICAL_ALIGN_CENTER = 1
Align to the center of the parent ArcLayout.
VERTICAL_ALIGN_INNER
public static final int VERTICAL_ALIGN_INNER = 2
Align to the inner edge of the parent ArcLayout.
VERTICAL_ALIGN_OUTER
public static final int VERTICAL_ALIGN_OUTER = 0
Align to the outer edge of the parent ArcLayout.
Public constructors
LayoutParams
public LayoutParams(@NonNull ViewGroup.LayoutParams source)
Copy constructor
LayoutParams
public LayoutParams(@NonNull Context context, @Nullable AttributeSet attrs)
Creates a new set of layout parameters. The values are extracted from the supplied attributes set and context.
| Parameters | |
|---|---|
@NonNull Context context |
The Context the ArcLayout is running in, through which it can access the current theme, resources, etc. |
@Nullable AttributeSet attrs |
The set of attributes from which to extract the layout parameters' values |
LayoutParams
public LayoutParams(int width, int height)
Creates a new set of layout parameters with specified width and height
| Parameters | |
|---|---|
int width |
The width, either WRAP_CONTENT, MATCH_PARENT or a fixed size in pixels |
int height |
The height, either WRAP_CONTENT, MATCH_PARENT or a fixed size in pixels |
Public methods
getVerticalAlignment
public int getVerticalAlignment()
Gets how the widget is positioned vertically in the ArcLayout.
isRotated
public boolean isRotated()
Gets whether the widget shall be rotated by the ArcLayout container corresponding to its layout position angle
setRotated
public void setRotated(boolean rotated)
Sets whether the widget shall be rotated by the ArcLayout container corresponding to its layout position angle
setVerticalAlignment
public void setVerticalAlignment(int verticalAlignment)
Sets how the widget is positioned vertically in the ArcLayout.
| Parameters | |
|---|---|
int verticalAlignment |
align the widget to outer, inner edges or center. |
setWeight
public void setWeight(float weight)
Indicates how much of the extra space in the ArcLayout will be allocated to the view associated with these LayoutParams up to the limit specified by setMaxAngleDegrees. Specify 0 if the view should not be stretched. Otherwise the extra pixels will be pro-rated among all views whose weight is greater than 0. Note non zero weights are only supported for Views that implement .Widget.