Jing Hu Jing Hu - 5 months ago 19
Android Question

how to look throuth android Attribute document

<shape android:shape="rectangle">
<stroke android:width="1dp" android:color="@color/designer_cell_background" />
<solid android:color="@color/designer_cell_background" />
<corners
android:radius="7dp"
android:topRightRadius="0dp"
android:topLeftRadius="0dp"/>
<padding android:bottom="1dp"/>
</shape>


just like this code,if i want to know what attributes shape has and what's meaning they are separetly. How should I do,Is there any document
to refer to .Thank everyone for help in advance.

Answer

The attributes that you can can define for shape are:

  • visible: Determines if drawable is visible.
  • shape: rectangle, oval, line, ring
  • innerRadiusRatio: Only valid if shape == 'ring'. Inner radius of the ring expressed as a ratio of the ring's width. This value is ignored if innerRadius is defined.
  • innerRadius: Only valid if shape == 'ring'. Inner radius of the ring. When defined, innerRadiusRatio is ignored. When undefined, innerRadiusRatio's default is used.
  • thicknessRatio: Only valid if shape == 'ring'. Thickness of the ring expressed as a ratio of the ring's width. This value is ignored if thickness is defined.
  • thickness: Only valid if shape == 'ring'. Thickness of the ring. When defined, thicknessRatio is ignored. When undefined, thicknessRatio's default is used.
  • useLevel: Only valid if shape == 'ring'. Allows one to draw only part of the ring (arc-wise), by modifying the drawable's level. This setting only makes sense in context of a (LevelListDrawable).

The children that you can can define for shape are:

  • size: Determines the size of the shape.
  • gradient: Adds a background gradient to the shape.
  • solid: Adds a solid background color to the shape. Overides gradient element.
  • stroke: Adds a border to the shape.
  • corners: Adds rounded corners to the shape.
  • padding: The padding for the content within this drawable.

Reference

Comments