Android : How to draw layout with slanting and curved edges like this? - android

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.

Related

How would I draw this shape in Android using xml?

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.

Apply a gradient to a listview in android

I'm trying to use a listview in my application with a gradient from the bottom.
I do not want to use the gradient in the background, I like to use it in the listview.
To try to explain better, I attached a picture of what I want.
The background will show images that will change.
I searched a lot and made ​​several tests, but without success.
I appreciate any help.
Thanks and regards
Android has something built in for that. It is called fading edge. The two XML properties are android:fadingEdgeLength and android:requiresFadingEdge. If you were hoping to have the image gradient change, I don't think they are dynamic.

Custom view widget

I was browsing internet for tutorial on custom view widget creatin, but they all were creating views of regular form, like rectangle, circle. But I need a widget that looks something like this:
Can you help me with brief overlook on how I create it? All that matters is outline form. I need it to be animated - I can extend it and shrink.
You can use shape drawables mentioned here: http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
If you are looking for making your own custom view by drawing the layouts on the canvas and providing it with the necessary functionalities you should look into this
Custom views

Draw circle in xml in android

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.

how to add shapes using java code to a xml layout?

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

Categories

Resources