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.
Related
I'm porting one of my iOS apps over to Android (which I'm pretty new to), and I was wondering how I would draw this shape in Android using XML:
I want to recreate the shape (the white object) at the bottom of a tableView. The image attached is a screenshot of the bottom of a UITableView.
Any help would be greatly appreciated if you need any more info just let me know.
Thanks
EDIT:
Sorry I wasn't totally clear, I'm actually trying to recreate the slight arch at the bottom of the table. Since it's so slight, you may not be able to see it with a quick glance.
It seams to me that you want to "lift" your table up a little bit. If so, you have to implement this attribute to your tableView:
android:elevation="2dp"
or in java:
tableview.setElevation(2);
My opinion when reading this question: Stop trying to make your android apps look like iOS apps !!!
If you still want to do it.
Just have the background color for your activity to that color and set the layout_margin to either 2 or 4.
It should give you your desired effect.
I am unable to figure out how to design layout in android like the images shown below.
Please suggest some solutions in order to achieve the same.
This can be achieved in two ways:
1- Use images in the background and position them accordingly.
2- Write your own View class and override the onDraw(Canvas canvas) method. You can get help from Android documentation.
Creating Custom Views
Creating a View Class
OR
Check this solution for help:
Android custom shape
As the other answers said, you can create custom views in android.
The curves are called Bézier curves. Similar questions have been asked before.
This question and this tutorial might help you on how to implement the curved view.
You can use SVG wave for background, and you can use this link to make online.
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.
good afternoon
How could I get a design like this in my android application?
http://s2.subirimagenes.com/otros/previo/thump_7851660img20120718wa0000.jpg
That is, divided into three areas with different background color to the background activity. And for example in the first zone instead of having these options has a TextView and edit text where you enter something.
How to make something like that image what kind of layout is more recomedable use? Linear, Relative ...
Thanks in advance
You could use a fragment layout and use fragments to get that layout
The best way is to use PreferenceScreen with three PreferenceSections.
As per my requirement I need to add tow rectangles in a existing xml layout through java code. I can create the rectangle shapes using ondraw method, but using intents in fresh layout. I need to display that shapes in existing layout. If any one faces this experience, please help me to create shapes in a xml. Any responce would be appreciated.
Thanks in advance
If the rectangles have a predefined place and size it it only a question of changing the visibility at runtime.
Give the rectangle the attribute android:visibility="gone" in the xml, and from the code use the setVisibility(View.VISIBLE) on the reference to the widget when you want to show it. In this way you may hide it again when no longer needed.
If this answer does not help you please specify more details and I may be able to help you better.
BR,
Vanja