Android ListView Faded Edge - android

By default, the faded edge at the top of a ListView only shows up once you start scrolling through the list. Is there any way to have that top faded edge shading show up even when you haven't scrolled down at all?
Thanks!

In this case, I would remove the fading edge from the list view and just add an ImageView right above your ListView(perhaps both of them together in a layout) and make the src the drawable of the fading edge.
You can find the drawables in your sdk folder/platforms/platform-version/data/res/

Related

Fading edge in RelativeLayout in Android

In the ListView from Android you got native an fading edge on the top and bottom of the view if you are getting to the end or top of the list while scrolling.
Now I was wondering if it was possible to build that same fading edge into the edges of the screen of my application? (So basically in my RelativeLayout)
Can someone give me some guidance on this?
Here is a picture for a better understanding for what I want to achieve.
If I drag an object to the left I want to fade in the blue edge and if I get closer to the edge it must be getting brighter and stronger as color.
What you need to do is put your RelativeLayout inside a HorizontalScrollview and add the following line to your HorizontalScrollview:
android:overScrollMode="always"
You also can do it in code:
yourHorizontalScrollview.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
Check the following link if you want some more information.
http://developer.android.com/reference/android/view/View.html#setOverScrollMode(int)

Move an element in relative layout to absolute edge of the screen

Is it possible to move a button or any other element in relative layout to the absolute edge of the sreen? If I drag a certain element to the edge of the layout, eclipse will automatically place it a few dp away from the edge. It'll basically just create a small space between a button and the end of the creen. Is it possible to bypass that?
I know buttons aren't meant to be that close to the edge of the screen anyway, but I need it for a certain thing.
The normal button has a little padding by default, because the buttons backgroundimage is a 9-patch image with padding left, right and on bottom. That's why you see the space between button and screen.
To solve this you can use a custom button. For example change the backgroundimage of button like this android:background="#drawable/image".

Android: Drag View outside screen

I have an activity where users can drag and drop around some buttons.
All my draggable views are inside a RelativeLayout and to drag them around I change their top and left margins.
Everything works perfect, except that when I drag the views close to the right and bottom edge of the screen, they shrink instead of being drawn outside the screen.
Is there any way for having the same behaviour on the all edges of the screen (currently only works fine on the top and left edge).
I guess I can have a left and top negative margin. But when I have left margin > screen width or top margin > screen height the images shrink.
To implement custom positioning of views inside a ViewGroup the best way is to implement your custom ViewGroup overriding onLayout().
It is not that difficult and I explained how to do it here. (the question is newer and has more visibility)
Edit:
You might also want to look into the Drag and Drop Api here. Thanks to Zainodis for the comment.

How to draw List Under ImageView With transparent Areas

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.

Android slide animation problem

I have a 3 horizontal views - an image on the left which is a thin vertical handle-type bar and an image to its right followed by a textview. What I'm trying to achieve is a sliding animation, activated with a click on the handle, so that the center image slides in and out to the left (and so disappearing when fully left) with the textview following this animation smoothly. The effect will be the handle remains in place (hence I can't use the SlidingDrawer), the image comes and goes and the textview is always present but slides into the space where the image went. Its just collapsing the image really.
The problem is if I apply android.R.anim.slide_in_left/android.R.anim.slide_out_left to the image and the textview simultaneously I see they slide completely to the left edge of the screen, temporarily overwriting the handle. Is there a way to still animate but not go all the way to the screen edge?

Categories

Resources