I want to create android buttons but the look something like the one in picture.
Normal android buttons are curved and their boarder are not joined... I want my layou
Is there a way to create a layout like this?
You can turn any ImageView into a button by setting an onClickListener on it.
Edit to better answer the question: The layout you show can be created by putting a bunch of ImageViews in a horizontal LinearLayout. The LinearLayout has a blue background. The images that provide the sources for the ImageViews have a transparent background.
Buttons are just TextViews extensions. You just have to change its background with a xml drawable which has three states
Related
I want to create a custom shaped button like this:
I'm able to achieve a similar thing by using a RelativeLayout and overlapping a rectangle and a circle. But that way, I have to add 2 onClickListaners, one for each shape.
Is there a way in android ( other than using an image, because in image the entire rectangular view will be clickable and not just the button ) to create such a design using a single XML layout file ??
you won't have to make two listener just make one listener for the RelativeLayout
I'm new in android design.
I want to create a view like this:
In fact, I want to create two things:
A header like this image header that has an image with a transparent overlay.
Like my header, I want to create recyclerview items, with image and transparent overlay too.
It is necessary to mention that, I want to use Picasso library to show my images.
How to I create this.
Thanks a lot.
For grid element you can use RelativeLayout. On the first layer put ImageView with your image, above this you can put View with overlay background (for example semi-transparent black color), and then you can add your text. If you want to create text like on your image (two TextViews above center) you can put empty View element with some height (this height will be like margin between two TextViews) and in top text add layoutAbove="centerViewId" and in bottom text: layoutBelow="centerViewId". I can paste xml code if you want, but I think in this way will teach you more.
In an Android app I have a background image and two buttons on it.
This is a partial screenshot:
I ask you for the best approach to click on the sinopsis button to show an overlay text, like this:
and also to click the fotos button to show an image slider, like this:
I don't want you to show me any code. I only need recommendations to know what kind of layouts or overlay views I should use to obtain the shown behaviours.
Thank you.
A simple TextView is enough. A TextView can have a background, translucent as in your case, or gradients, etc., and padding. You can fill it with Spanned Text so you could use hyperlinks, bold, colors, etc.. If you need scrolling, TextView also supports scrolling out of the box, but it'd be better to put it inside a ScrollView because the scroll will be smoother. In any case you don't need additional layouts.
You can just use a container layout (like LinearLayout. RelativeLayout, ScrollView, etc.. depending on what you want) and specify that to have a background image and then specify your drawable. You can then use TextView to display text. Don't forget though that you will have to create custom TextViews to achieve your design.
TextView can have transparent background and so, you can get the overlay effect.
I am working with a relative layout in Android. I want to have a glow effect when I click on a relative layout on screen. How to archive it?
From what you have posted it seems you want your layout to have two different backgrounds depending on whether it has been clicked or not.
You achieve this by setting a selector to background
selector example
I'm trying to build an Android app where I would like to display some Buttons in various places, as in the demo image attached.
The challenge here is creating the custom buttons and arranging them.
As for the custom Buttons, I guess I could achieve that using CustomViews or a simple button with a Custom Drawable as Background.
Are these the right points to start, any other ideas?
On arranging them, I have no clue how to achieve that.
As Android_Crazy and Closeratio have already said, a RelativeLayout is the most suitable option for custom placement of buttons in general. However, for the exact placement of buttons pictured in your example, a LinearLayout would work just fine.
In a LinearLayout you may place views under or above eachother (with android:orientation = "vertical", relevant for your example) or next to each other (android:orientation = "horizontal"). You can also add margin to your views to alter the horizontal position (layout_marginLeft or layout_marginRight) or the vertical position (layout_marginTop or layout_marginBottom).
As for the buttons' appearance, I always use custom background drawables, usually with a custom xml to add a different drawable for when the button is being pressed or selected.