Fading at the bottom of a scrollable list on Android? - android

I have a long ListView with a white background (android:background="#android:color/white") and transparent cache color (android:cacheColorHint="#00000000"). Two questions:
I am testing on a variety of devices. On older ones, the fade works fine. But on the newer ones, I am not seeing any fade at all, just a sharp cutoff. Why might that be and how do I fix it?
A lot of the times the elements in my list line up so that there is
just enough whitespace at the bottom, that the fade doesn't reach
the text and is not visible. Is there a way to make the fade cover
more of the list?

Found my own answers:
android:requiresFadingEdge="vertical"
android:fadingEdgeLength="48dp"
EDIT: changing to dp instead of sp

Related

Textviews don't get animated in a SharedContentTransitionAnimation

I came across this solution: How can I scale textviews using shared element transitions?
But this is not working, when I use this solution, I don't get any animations at all.
The problem is the size of the text inside textviews, and the color of the text. They don't get animated and the movement animation looks really weird. Should I make a animation that runs after the SharedContentTransitions have completed? Or is there a fix that makes this issue a whole lot easier to fix?

In a ScrollView, can I make the scrollable edges glow constantly?

I have a help screen that comes up before my android game starts. It's a ScrollView. While playtesting, I found that almost without fail the players would tap on the screen at various points until they accidentally moved the screen a bit. Then they realized it was scrollable.
This isn't a good experience. I want the scrollable edge of the screen to glow constantly so that it's obvious that you need to scroll. Simply showing the scrollbar doesn't help because it's so minimalist. Even if it's wider I'm not sure it would attract the eye enough to clue people into the need to scroll.
Is this possible to do or do I need to derive my own version of ScrollView? If the latter, what do I need to do to make the edge glow?
One way, theoretically, is to use:
yourScrollView.setOverScrollMode(ScrollView.OVER_SCROLL_ALWAYS); // android:overScrollMode="always" in XML
However, I've had no luck with this feature (at least with vertical ScrollViews). Instead, I would recommend adding an arrow down the side of your page, or some text that says "scroll down". This way, it will blend in nicely with your app.
Alternately, you could make the scrollbars more visible (perhaps bright pink!) by employing this tactic (the article is on ListViews, but it should work for a ScrollView too), in addition to always showing scrollbars.

Preventing Pixelation of Images, indenting listViews and adding Rounded corners

I have a few issues and questions regarding some UI development on Android. Firstly look at this image:
Firstly at image A) This is a image that I insert and repeat horizontally to give the zig-zag shape at the top of the screen regardless of screensize and above that a textField with no content and a background color - But as I'm sure you can is that the two colors don't match up quite as perfectly as it should even though they both have the same hex color value (#BF0426). And secondly, you can also see some serious pixelation on that zig-zag image. How do I fix these 2 problems?
And then at image B) Here I have a simple listView. What I would like to do, is firstly indent it a bit on both sides, and round the corners of the top and bottom item. So basically I want it to look like the blue border drawn on the screenshot. (Your typical iOS listView). How do I go about doing this?
Thanks in advance for any tips!
For the image. Just out of curiosity, why wouldnt you simply extend your image to include the top pixels as well? In other words, build your repeating image such that it incorporates the pixels that you are trying to create using the empty textview. This will at least take care of the color missmatch, as the color will all be generated from the same place. In terms of the pixelation. Are you truly repeating the image, or are you spreading the image. A spreading will definitely cause what you are seeing.
For your tableview:
For the left and right indent, you can simply use the margin or padding attributes of tableview item. There are generic padding and/or margin attributes (which will pad all of the top, bottom, left and right), or there are separate padding and/or margin attributes for each top, bottom, left, and right. Here is a great link on padding versus margin that you may want to read.
Difference between a View's Padding and Margin
Example attribute (as called in an XML file) for bottom margin
android:layout_marginBottom
setMargins(left, top, right, bottom) // for setting margins programmatically
Example attribute (as called in an XML file) for top padding
android:paddingTop
setPadding(left, top, right, bottom) // for setting padding programmatically
For the custom top and bottom, you should be able to use the following tutorial
http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/
From here, you should be able to detect the item as the first and last item and set the background property (image) to a background image that has a rounded top or rounded bottom. This is how I do it on the iPhone. I have also implemented things that LOOK like tableviews but are simply vertical layouts with my own custom views that I have made to look like what you are wanting.
One thing to consider is the file format you use is going to mutate the image as you save it (lossy compression), so a .jpg with a certain color may look different than a .bmp with the same color. Make sure you author using the same application and/or export settings when trying to match up images.
Also, if you created your image with a DPI that is not compatible with the android display it can cause serious pixelation in detail areas, especially with gradients and drop shadows.

Large Text Shadow on Android

I have an app where I am trying to add text shadow to a TextView. The problem is: the shadow is always very thin. I'd like it to be thicker.
I am trying to generate "memes", as some of you might know from the "fun sites" on the internet. My goal is something like this font:
http://d24w6bsrhbeh9d.cloudfront.net/photo/4324188_460s.jpg
I am using the same exact font, Impact. The problem is, when I add a black border shadow, the shadow is not visible enough and it's not wide enough. It's barely barely noticeable.
I am defining a FrameLayout, with the picture on the bottom and two text fields, one on the top and one on the bottom. The shadow is barely visible for both of them.
I have been using the parameters, shadowDy, shadowDx, etc. I know the shadowRadius is the parameter that actually defines the border size, but I have been experimenting both with values above 1 and below 1, and I can't seem to get any good results. There are minimal changes in size and shadow density, but nothing useful.
I have considered another option, which is a last resort, which is drawing the text twice, a bigger black font in the BG and align the character spacing so that the black text becomes the shadow of the white text on the front.
Thank you in advance !
You won't be able to accomplish that effect with the basic TextView shadows. I'd look at adding a stroke instead:
https://stackoverflow.com/a/2151964/321697
http://developer.android.com/reference/android/graphics/Paint.Style.html

Bitmap colors change while scrolling

I have a ListView that has a subtle gradient bitmap in the background of each item. I noticed that when I scroll the list, the background gradient becomes banded and changes color. The gradient is a dark gray and when it scrolls is becomes subtly green and banded. It basically looks like the quality of the images greatly decreases as it scrolls.
Most of the time, as soon as it finishes scrolling, it returns to the normal quality. Sometimes it actually stays poor quality even after scrolling stops. On a Nexus One it almost always stays low quality after scrolling.
Is there a way to avoid this?
Note: This is not the common ListView background problem discussed here: http://developer.android.com/resources/articles/listview-backgrounds.html
Here is an enlarged screen cap to show the difference. On the left side is the background normally. On the right half you can see what it looks like when it scrolls.
You need to add android:cacheColorHint="#0000" to your ListView in xml.

Categories

Resources