How to add a button widget to a rectangle canvas in Android? - android

Hi, I want to develop a form on a rectangle.
I have designed a rectangle using a bitmap and an image, but how do I add edit texts and buttons onto that?
Please provide some good guidelines.

You can create a layout inside your main layout with background as your bitmap image.
Then put your widgets inside this inner layout.
When you place your widgets be sure that it is coming correctly in all screen sizes.
For that try to avoid manually setting pixel values.
Use dp instead.
Also use layout properties of relative layout.

Related

Layout with decreasing height from one end to another in android (inclined on one side)

Here is what I need to attain
The Application logo goes inside that blue background. Can I somehow tweak Linear or Relative Layout to attain that inclined bottom? Or is that any other solution to this, other than simply using an image itself?
No, Views in Android are all rectangular, and LinearLayout and RelativeLayout only deal in rectangular measurements. You're going to have to do some special drawing or use a background image or something along those lines.

Android: ImageView Border With Buttons

I am looking to make an ImageView that I can manipulate with touch (translate, scale and rotate). I currently have one that uses ScaleType.MATRIX and can be translated and scaled. I would like to be able to wrap this ImageView with a border, and put ImageButton objects in the corners to act as a 'close' and 'scale/rotate' button. Much like in the image below (taken from the Aviary app):
I cannot figure out where to start with this. In order to manipulate the ImageView I need to set the view to MATCH_PARENT, and use a Matrix to manipulate the drawable within it. But then how am I supposed to wrap the drawable in a border?
Or am I supposed to manipulate the ImageView directly instead of the drawable? If so, how would I go about doing that with a Matrix?
Create a frame layout and add the four buttons on it the add the frame to your layout. Use the onclick of that buttons to create different functions you mention.

Android Canvas only take up only part of screen

I am trying to draw 3 lines real time, whose co-ordinates are constantly updating. In this link, How to draw a line in android, it is explained how to draw lines, but they take up all of the screen. How do I get it to take up only part of the screen, and let my layout main file take up the rest. Is this possible?
Thanks,
Rokky
If you wish to dynamically create the DrawView, as your example shows, 1cCreate a view (perhaps a FrameLayout) within your layout xml which will hold your canvas, and use standard Android layout techniques to make the FrameLayout be the right size.
Alternatively you can create the DrawView statically by placing it directly in your layout; How to add CustomView to Layout fromXML? shows how to do that.

how to design this UI in android app

i am trying to create the following UI in android app
In the above image all the five are to be image buttons. How to design this UI as like in the screen shot please help me friends....
Inside LinearLayout take RelativeLayout and make it centrally aligned.Then
Take first image Near me and set it's property.
Now take the second image Explore and set it to right of first image.
Place third image My network and place it below first image.
Fourth image Live set this to right of third image and and below second image.
Now center aligned your center image.
You will need to create 5 images, each of which has transparent areas. This layout type lets you position elements relative to the layout group itself, as well as to items within the group.
I'm not very familiar with Android advanced layout design, but the common layout objects give an idea:
There is a SurfaceView which gives you the ability to manipulate z-coördinates. In the SurfaceView you can then place a Grid/Relative/TableLayout for the 4 buttons (which you pre-render as rectangular images with transparency) and a simple Layout which centers and only contains the middle button.
If you then set the Z value of the first layout to less than that of the second you will get the view you want.

Android. Draw bitmap between two layouts

I want to make application which will have background and some picture with alpha channel in front. Between them i want to draw bitmap/animation.
How can i do it ?
That is easy. You can use FrameLayout as the root layout and set a background to it. Then add two more LinearLayouts which fill the screen. In the first you may add your animated views like ImageView, while in the second you can insert an ImageView or ImageButton with a transparent image in it.
There are many other ways to do this like using a custom view for your animated layer etc. Check my example here: How can I use the animation framework inside the canvas?

Categories

Resources