0

I have a drawable with ractangle shape now i have use that drawable as the background for the spinner so my spinner looks like a ractangle. now i am thinking that how can add some down arrow (which will be image) to the right side of that drawable. its like right side of that ractangle would be down arrow but its a part of that drawable. below is my xml for ractangle

    <?xml version="1.0" encoding="utf-8"?>
<!-- res/drawable/editdraw.xml -->
<shape
  xmlns:android="http://schemas.android.com/apk/res/android">
    <corners android:radius="3dp"/>
    <stroke android:width="2px" android:color="#666666"/>
 </shape>

in this xml can i do some magic so image can be added..

or else any body have some different method to implement it than just share with me. if i am wrong than please suggest me also.

School Boy
  • 1,207
  • 2
  • 19
  • 33

1 Answers1

1

Yeah you can do that with a shape, using layer list which will contain multiple shapes. This way you create your shape rectangle and a shape like a triangle and put them in the list. Check these questions about layer-list :
nested shapes in android sdk Can I use multiple shapes in one Android drawable?

The triangle shape will be a bit tricky because it does not exists in the SDK but you can create a class that extends Shape or ShapeDrawable, and use it in your xml. (Im not sure of that, you might need to define these shapes directly in java)

Community
  • 1
  • 1
Sephy
  • 50,022
  • 30
  • 123
  • 131