How to draw List Under ImageView With transparent Areas - android

i was trying to let the ListView on Scroll pass the transparent area in the ImageView, like (Android Market) style, but it wont.
I've tried to set Padding to the ListView and still the problem appears, disable Clipping,
the green area should be transparent.
the red is the list.
and the blue pointer points to sample area that should be
transparent, but the clipping cuts the children's in the list.
any ideas how to solve it?

You can put the ListView and the ImageView inside a FrameLayout and adjust the top padding/margin for the ListView to suit your needs.
This way the ImageView will be drawn on top of the ListView.
Also, make sure that the ImageView doesn't have any background color defined and that the imageview's source png image is transparent.

Related

Android layout development

I would like to develop a layout below. I am really confuse related to that. I used RelativeLayout, FrameLayout to develop this. But I am not getting perfect output. As per below image, the Dark Gray color is overlap the light Gray layout. If I used Relative layout then dark Gray will be in the light Gray area. And if I used FrameLayout then the other controls of light Gray will not set perfectly.
Please guide me the right path. I am stuck in this layout. Thanks in advance.
According to your figure, If all widgets need to show without scrolling vertically , you can have vertical linear-layout here,
TextView
Button,
ImageView
List view with defined height
Other widgets

How to set border of Gridview

I am developing an Android app. And i am trying to show a DashBoard. DashBoard is working fine. I have taken gridview to display it, But I want to set the border of that gridview. How can i achieve it ? if anyone can suggest me something useful.
You can override GridView drawing and draw border from there.
You can add rectangular shape as the background.
You can put your GridView inside another layout, set background color for that layout and set margin for the GridView. (not really good as Android has to draw big single-color view and then cover it with GridView)
Lots of ideas here: How do I put a border around an Android textview?

How to 9-patch so icon always stick with centered text

Basically, I wanted to have a button where text and icon stay in the middle of the button at all times. The Button has match_parent width and center gravity. I tried to use drawableLeft but that put icon on the left most of the Button and not next to the text.
So I'm trying to create 9-patch image as shown in the image above. Basically, I want all the text to stay in blue box with the cyan rounded rectangle (icon) next to it. The stretchable area is in red. However I just can't make it as the content area always overlap the icon.
Is this possible with 9-patch? Or should I wrap Layout around the TextView and use that as a button instead?
By the way, the included image is just to show what I plan to do. The actual image will be in other colors and without all the red.
When you create a nine-patch image, you put some black lines on the right and bottom of the image. These lines define the region that will be use to place the content inside of your image.
Here is an example :
It will look like this :

How to remove the android Button Background margins?

I'm new to Android dev, I'm trying sth simple: I want to place a set of 3 buttons horizontally in a line, each with its own background PNG image. So I create a linear layout (horiz) and put three Button elements, each with a weight of 1, and set each button's Background property to some png file. The buttons' width/height is set to wrap_content.
But what I get is that the png does not cover the entire button horizontal area. Instead, the background image is scaled down and keeps some sort of margin from the button view outline as shown in the visual designer. This also shows up in the emu. I tried forcing 0 in the layout's padding/margin - nada.
any idea on how to actually get the background image of a button to cover the button's background??
tnx
I believe you would need to make a new 9-patch, as that small margin is saved into the button image itself.
Try negative values for the buttons layout_margin.

Android: Stretching ImageView with background

I have a landscape layout that features a vertical LinearLayout of buttons on the left side of the screen and a user-defined picture on the right of the screen. The design I'm working from calls for a double-stroke border around it, which I implemented by creating a rectangular shape background with the border being the outer color and the background of the shape being the inner color. I then just put some padding around the picture, and you get the double-stroke border. The problem is expanding the picture to fill the space in the layout. I don't know the dimensions of the picture, since it is user defined, and I'd like it to expand to exactly fill either dimension while preserving the aspect ratio. Setting fill_parent for both width and height does that, but it also expands the background all the way to completely fill the cell, resulting in a sort of letter boxing effect. Is there any way, short of just adjusting the size of the view after layout, of getting this to only expand the view as much as necessary?
I never got this to work properly, and just ended up adjusting my layout to a different arrangement.

Categories

Resources