I need to show to the user the speed of my robot's motors.
I thought about something like that:
How can I achieve this in Android? Should I use Canvas? Or maybe you can point out a better way to represent these motors' speeds?
You should use ProgressBar with a custom layout.
You can then update the progress using ProgressBar.setProgress and customizing the style is well documented.
Here is a relevant thread describing exactly how to customize it ~ How To Customize a Progress Bar in Android
Related
I am using the latest MPAndroidChart library, and I was wondering if there is way to set a dual-background color on the chart. I need the colors to match a certain number of days that will be displayed on the x-axis. I would like to be able to do this programmatically as I will be using real time data, so the background will be set to a certain no. of days and move along as the chart is updated.
I think you will have to programmatically create a bitmap that always changes according to the latest realtime data you get. Then, you use that Bitmap and set it as the chart-background.
There is no way to set a specific background color (or multiple) in the way you describe it other than via the methods and ways the View class itself already provides.
In order to get the style that I wanted I downloaded the source-code and edited it to allow me to add a Bitmap image to the graph background. So now the background is redrawn when new data is entered and then added to the graph background so that it looks like the date is linked to the background color. Thanks again to Philipp Jahoda for the brilliant library and thank god for open source developers.
p.s if I ever get rich off of this app I will look after you.
I often see this UI pattern on Android. It consists of a circle .
First Google Fit uses it.
Timely has the same UI pattern. And you can interact with it , change the timer.
It is not part of Android standard View.
What is the name of this view / UI pattern ?
Can you give links to similar open source library ?
Thanks everyone who posted the comments.
Let's call this custom widget Circular SeekBar
https://github.com/RaghavSood/AndroidCircularSeekBar
https://github.com/devadvance/circularseekbar
https://github.com/TriggerTrap/SeekArc
Or Circular ProgressBar
https://android-arsenal.com/details/1/1513
https://android-arsenal.com/details/1/1446
https://github.com/passsy/android-HoloCircularProgressBar
These are custom widgets, developed by application developers - it's not part of Android Framework, yet it's relatively easy to write own circular widget. See docs here.
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.
I have a design Mockup of a remote control with 4 buttons and a Text Display. Now i want to create an Android Activity which looks like this mockup. How can i do this.
I think taking the design image as background for the activity is not the right way to do this (how would i make the buttons on the image clickable, etc...)
Can anybody give me a hint how to start here?
kind regards
You should create 9-patches(or patterns) for each graphic element on your layout for proper layouting on all available devices.
Then apply this patterns to your UI elemnt's(ImageView's, Buttons, TextViews) backgrounds.
Refernces:
http://developer.android.com/tools/help/draw9patch.html - 9-patch documentation
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html - 9-patch creation
http://developer.android.com/guide/topics/ui/declaring-layout.html - Layouting
You can use your background easily but the rest need to be done in Android.
First : download android sdk
second : create your project
third : code :)
If you're familiar with HTML, that should be kinda similar. You separate the cliclable parts from the background (the buttons), and make them ImageView, setting an onClickListener.
You'll need some Photoshop skills to do that, or ask a buddy designer to do that for you :)
Be careful with multiple screen support, since the background may get trickier to make it look right on every supported screen size.
I know basic level Android, but haven't had done animation before. Moreover, I don't have any clue as to how can I create custom Geometrical objects like triangle, Hexagon, etc.
Moreover, I don't know anything about doing animation in Android. I'd like to have relevant tutorial links or blogs which can help understand the basics and preferable a sample code for "Rotation" animation.
Thanks in advance.
http://code.google.com/p/nehe-android/ (the code is best documentation ^_^)
but it is for open gl custom objects on top of your view/surface view, it is commonly used in games.
If you want to do just rotation for Button, there are http://developer.android.com/reference/android/view/animation/Animation.html and subclasses of it (RotateAnimation and so on), you can even do a custom one. By this way you can do awesome user experience for application which use default android controls.
Cheers