Does any one have any idea of creating a custom component like the below image instead of using the image itself.
I know how to create a rectangle (a rounded one using the xml and not in java) which was discussed in the link here but i am not able to work with something like the pointer part.
does anyone have an idea to do this i would be happy if i am suggested.
Create a class that extends PopupWindow and set the background through code so that you can replace its color.
Here is a easy sample PopupWindow: http://www.ceveni.com/2009/09/popup-window-in-android-sample-program.html
See this post to know how to change/replace colors in a drawable: How to change colors of a Drawable in Android?
The adjust() method from that post is enough for you.
Create a new PopupWindow, load the bg drawable, change its color and set the new drawable to the popupWindow.
You can make use of customized popup window. I never tried it before but you can give a try If you succeed please share it here....
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.
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/
Is that possible to have a custom ProgressBar in Android like this:
I mean:
Not spinning (static)
Progress with one color and remaining area with another color
With text in center
If that's not possible, what's the nearest result that I can have? Maybe using XML Shapes? Thanks!
There is not a standard Android component for reaching this result.
However, there is a library that you can use to achieve that effect.
Check this library.
You can customize this component as you like and use it on your xml layouts like a Custom View.
Check this library: https://github.com/wasabeef/awesome-android-ui/blob/master/pages/Progress.md. It does what you want.
Now I have this task where I should create a rating bar just like youtube in my app , and so my idea was to have a textview where I set its background to a color but then remove the color according to an equation I will make so it displays only a percentage of it... any idea how can I do this or where to look ?
The simplest way to do this would be to create a selector.xml. You would assign android:background="#drawable/selector". Your selector would decide which background color to show based on what percentage you have assigned.
This link explains how to use selectors with buttons. It should help to get you on the right track...http://developer.android.com/guide/topics/resources/color-list-resource.html
EDIT: You can still accomplish a custom progress bar by xml. It is very similar to the selector. Just think of it as many more selectors based on progress instead of state. Here is a nice example...Custom Drawable for ProgressBar/ProgressDialog
You can also look into xml animations. They are similar.
I am trying to display my layout via android xml.
Here's what I want to do:
I have 12 buttons with a animals image like this one: , and the circle is the background.
I do not have any idea related to this, how should I start?
Please give me some suggestion so I can go ahead. What things should I use to do this?
You'd be looking for making a custom view. A good place to start is, as always, android's own development site: http://developer.android.com/training/custom-views/create-view.html
i think you can do this with xml. this need simple mathematic calculation that you can not do in xml.
you most extend View class and create your own View. then you can use it in xml.