1
<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.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
Jing Hu
  • 67
  • 8

3 Answers3

0

The first stop you need is the documentation on Accessing Resources.

There is also another answer that covers a lot of it, but I won't repeat here, and they also recommend the documentation.

Community
  • 1
  • 1
SQLiteNoob
  • 2,958
  • 3
  • 29
  • 44
  • I have look through your answer,and I still hava a question that how I can know what attribute can place in shape element in previous code. – Jing Hu Jun 11 '16 at 14:01
0

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

Juan Cruz Soler
  • 8,172
  • 5
  • 41
  • 44
0

we can search shape attributes by google !

And then it will show this

https://developer.android.com/guide/topics/resources/drawable-resource.html#Shape.

Yes, there is almost everything we need about Android in developer.android.com .

Jing Hu
  • 67
  • 8