Ragaisis
Ragaisis

Reputation: 2750

How to create arrow type layout?

I have start and end date time fields that look like in picture below. Blue color shows active selection - if we select right then blue color goes to right and white color appears on the left and vice versa.

enter image description here

Hardest part is to create that arrow style in the middle. What should i use because buttons are rectangles and I don't know how it could be done.

Upvotes: 0

Views: 351

Answers (2)

codeScriber
codeScriber

Reputation: 4612

you need a custom image according to what you ask, maybe extend ToggleButton for that but basically what you want is the same component when pressing on two different places on the same component will dispatch different events.

I would for example extend Linear layout, make it vertical layout, put two clickable textView\buttons with 9 patch images as background ,like suggested before, one for the white part and the other for the blue part. and replace the background image for any event u like. you can also create a StateListDrawable with actions for selected and deselected and set the state of each drawable upon the right click

Upvotes: 0

frogggias
frogggias

Reputation: 53

It's easy. Just use ninepatch.

You can start there: http://radleymarx.com/blog/simple-guide-to-9-patch/

Upvotes: 1

Related Questions