I'm going to have an application which will look like this:
As you can see, I'll have three buttons (including the envelop icon) aligned in a circle. This is rather easy to achieve in Photoshop, but NOT in android layout XMLs. Which layout class do you think is best in this case?
One more thing, how can I have a completely transparent button with an image in the middle. When I set
android:alpha="0"
the image also disappears which is not what I want. Any idea?
This is rather easy to achieve in Photoshop, but NOT in android layout XMLs.
Not really - you feel it's easy in Photoshop because you know how to do this in Photoshop. Once you have a fair idea of Android layout, that too will become easy for you.
Which layout class do you think is best in this case?
If I were to do this, I would have used RelativeLayout as the position of the two smaller buttons are relative to the larger one. Similarly the buttons as a whole is relative to the screen. So, may be 2 RelativeLayouts - 1 nested inside the other.
how can I have a completely transparent button with an image in the middle
Use transparency as the background.
android:background="#android:color/transparent"
Related
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.
I am making a lot of ImageButtons where the image aspect does not matter. That is, I do not care if it is stretched. They are invisible buttons to go on top of a background.
Is there an easy way to layout and stretch my ImageButtons through the graphical editor? I do not want to have to test out each possible padding in my xml. I just want to stretch the sides of the images as though it were an Office Word.
Ask if clarification is needed, please.
I'm not really sure to understand your question, but you can use android:scaleType="fitXY" to stretch your images, and android:adjustViewBounds="true" to have them adjust their bounds due to scaling.
I'm not 100% sure about your question neither. If you meant you want to do it in IDE, eclipse allows you to define the button with dragging.
I'm working on creating a menu screen, its fairly boring set of buttons so I wanted to add a curve to their layout to make it a bit more interesting. Like this:
I've just added the curved line to give an idea of what I'm doing - it won't actually have a line when done.
My question is what is the best way to go about doing this. I have tried using a linear layout and then applying a left padding to push them increasingly away from the edge. The problem here is that this depends on the screen size. On a small screen it displays fine and on a larger screen it does not. The second problem I have it that I'd like the entire curve to be centralized in the screen. Should I use a linear layout nested inside another?
If anyone has any ideas or sample layout xml as the best way to achieve this that'd be great.
Take a look on this widget, they doing someting like this
Maybe a relative layout so you can the position of each button relative to the one that comes below it?
I am having four piece of image.
Here I attached one sample image.
How can I create the round shaped image using these type of images?
Which layout is best for creating the UI for android?
Thanks in advance.
are you talking about something like this..
http://www.baijs.nl/tinycircleslider/
And for designing the UI for Android is depends on our requirement.it means whether you want to design something looks like rows and columns then GridLayout and tableLayout will be better,depends on requirement and look the layout will changes once try it your self and choose the best suited for your applicaiton.All the best Mate
inside relative layout add four imageview with attrs ParentTop, ParentRight, ParentBottom and ParentLeft. every image is rectangular with transparent extra area.
i can understand it is little hard to visualize on first attempt.
now come to click area. so a runtime decision about ignore transparent area click will be right thing.
more tricky way will be manage flags for all listeners and if two listener get calls its transparent area .
The image is what i'm trying to achieve. I tried using tab layout, relativelayout and linearlayout (and even a combination), but in no scenario i got it exactly right.
The requirements:
no overlapping of any component
no clipping of the image in the button (the green one)
the red bar is always at the bottom
in landscape, the components should still be in their same place, but you can scroll down
If required I can paste my current variations of the different layouts, but they are all rather big and messy.
Professional insights on which layout approach you would use is also appreciated, at least i can keep trying using the right things then.
At the moment, the orange things are normal buttons, defined like so:
<Button
android:id="#+id/btn_web"
style="#style/NewButton2"
android:onClick="webClick"
android:text="#string/Text_Web"
android:drawableTop="#drawable/jc_menu_web"
android:layout_weight="0.3"
/>
This is a problem on its own,because if you stretch the buttons using fill_parent, the result is that the image will be high at the top, whereas the text will be entirely at the bottom.Would be nicer if it were a centered image in the button.