I want make a custom button in android left solid arrow (only arrow shape not its background).
How can I create this arrow button using shape drawable XML in android.
I know how to create rectangle button but not arrow.
Anybody who knows it please tell me how to do.
Sorry I can't post code, only show you where to go.
But the ultimate answer is to use a pathshape button. Then it handles everything for you.
Create the paths by following the information at http://developer.android.com/reference/android/graphics/Path.html
You can learn more about shapes at http://developer.android.com/reference/android/graphics/drawable/shapes/Shape.html
Finally you can learn about tying them together at http://developer.android.com/reference/android/graphics/drawable/shapes/PathShape.html
That way you can do it even in XML. And there's a variety of arc path methods. Check it out!
Related
I am looking for a custom component to design a circular remote control view like the image below with different button and background color.
Each button should be touchable with proper press effect. I did find a useful library with this I am able to create somewhat similar design but still there are lots of improvement required like Press effect/ Inner and outer circle padding radius etc. Please help me to find the better option for this.
I think tihs is your answer.
You can download here.
https://code.google.com/p/radial-menu-widget/
You could make your own class extending view. You will then be able to override onDraw() and draw whatever you want.
You could also use default android Button with a custom xml selector defined with a different image ressource for pressed/not pressed states.
I've spent way too much time researching this, but I'm wondering if anyone can provide any insight to how Android does its spinner styling with the triangle dropdown indicator?
The reason I want to know is that I am using a custom textview as spinner item, and once I use that I lose the triangle. In addition, I want to make the triangle white.
I've seen previous answers with modifying the theme but I don't want all spinners to change so I don't want to modify the entire theme. I want to learn how Android does the triangle so I can recreate it. I tried using a list-layout drawable with a triangle shape but I'm wondering if there is a better way?
You can set drawbleEnd
android:drawableEnd="#drawable/imgresource"
create an image of how you want as your spinners background with whatever type or triangle and whichever color your want and then set that image as the background of your textview like this
android:background="#drawable/myBackground"
It a simple Nine Patch Drawable.
You can create a NinePatch graphic, set a black dot on the top and left to expand the top and left edges. With a triangle in the bottom right.
So lets say I have a segmented circle image asset inside an 'ImageView' widget, and I want to use each segment of that circle as a clickable surface to bring up a fragment with an image and some info.
Is there any way to build transparent arrangeable borders that I can use to do this with?
I'm using android studio with the default NavigationDrawer activity if that helps.
Maybe adding some ImageViews with transparent images on top of each section and making them clickable? That's how I'd do it. Of course this won't cover perfectly the area but it may work for what you need it.
So I found this. In case it can be of help to anyone else:
https://github.com/anupcowkur/Android-Wheel-Menu
Is it possible to create a completely custom shape in xml? I'm trying to create a button which looks like this: http://s11.postimg.org/e4izrlgrj/image.png (a mockup i did in photoshop)
I need to be able to create the outline shape and the small blue tab top right.
I have tried with some xml but getting nowhere close. I'm aware you can do something with Path class but never used it, is this the only option?
Thanks
I don't know about a completely custom shape but have you tryed using font icons?
Take a look at this: http://css-tricks.com/svg-sprites-use-better-icon-fonts/
How to Add triangle shape for activity or page change like in facebook page?
You can use QuickAction Dialog in android Here is example code .
If you are considered about the shape
See this answer
Also this article
And simple work around ::Give your parent layout transparent background and place the triangle in center of layout and you can achieve the position in the image
Or you can go for 9 patch images directly :: see this