List shows black colour - android

I have a listview to which i attach data using an Array adapter.
But when i scroll, i find the edges to be dark.
Why is this happening and how to stop it.
Any help please!!

That is just a hint that there is more data present at the end of the list.
try using
android:cacheColorHint="#00000000"
This will help

If u add TextViews or Different Views to listview apply listview background color to background color of those views .then u did not get the black screen when u scroll the listview

How does the hierarchy of your activity look like? If your UI only contains a ListView then it's easier to just inherit from ListActivity

Related

List View ,how to change Overscroll color

Hi i don't know what it is called so i don't know what to search for,hence here it is...
Please tell me what it is called and how to change it's color
This blue color appears when you pull a list view or a fragment.I want to change it
It's called the Overscroll. You can set the drawable like this
setOverscrollHeader(R.drawable.the_header);
setOverscrollFooter(R.drawable.the_footer);
You can also set it on your ListView through xml:
android:overScrollHeader="#drawable/the_header"
android:overScrollFooter="#drawable/the_footer"
There's a function setOverscrollHeader()
Use the drawable component within the parentheses.

Changing the color of each row in the Expandable listview in android

Now am working on expandable listview. I followed this link http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/
I want each row and its corresponding children of an Expandable listview to be set in a single color. There will be a main list in the expandable listview that i want each element to be in different color and when I expand I will get its children that should be in the same color as my parent.How can i do this? Can anyone help me thanks in advance.
That's relatively easy. You need to create an ExpandableListAdapter and implement the getGroupView() and getChildView() methods. There you can set the background color of every groupitem and child item to your liking.
you must have separate XMLs for Child and Parents.just set android:background with different colors in the layout like this ,also if you want different Text color,use android:textColor.This Would work!

Android: Transparent Colored ListViews with Background

I have a doubt I have a listview and below it there is a background with a image. I would like to have the lists with a transparent color in order to see the image in the background with the ListViews color. I have tried using a selector but it just applies to the select item i the listview.
Maybe it is not very clear so for that purpose I attach the following picture where the listview and the background is shown:
As you can see the item background is with color but the image is still visible
Thank you very much
Add following property in ListView...
android:cacheColorHint="#00000000"
it is for transparent background of ListView.
More detail see Here.
You can also use an image editor to edit the opacity of the image/shape/gradient/whatever that you're using for the rows. I use Gimp because it's free. Here's what you need to do in Gimp: Go to the 'Layers - Brushes' window. Right-click the image layer and 'Add Alpha Channel'. Then just dial down the Opacity using the number picker (located above the layer) and File -> Export the image. Add this image to your project. Set it as the background for the List View rows. Then set the background for the List View itself to whatever you want to take up the entire background behind the List View.
I managed to achieve this with the RecyclerView by adding this line of code to the 'onBindViewHolder' method in the 'RecyclerView.Adapter' class:
((RelativeLayout) holder.itemView).getChildAt(0).setBackgroundColor(Color.parseColor("#00FFFFFF"));
Bear in mind that the view returned by the above cast expression is an 'android.support.v7.widget.CardView' that contains the list item layout

How to make not to blink when item in ListView is touched

In the case of normal ListView, if user touch one of items in ListView.
touched item blink one time. I want that it doesn't blink.
How to configure ListView like above?
I've figured out myself. If we set color or textColor attribute, this problem resovled.
You can make a custom listview and set the color change of the listview item on click same as that of the background. So that it will appear there is no blink !!
Hope it helps !!
Set this in your list view xml:
android:cacheColorHint="#android:color/transparent"
In ListView xml just add this two lines inside ListView
android:listSelector="#android:color/transparent"
android:cacheColorHint="#android:color/transparent"

How to make divider part of each item in listview in android?

I wanted to change the divider height dynamically. From whatever I have searched it seems that it is possible through setting divider as part of each item in ListView. But I am not very clear with this.
So, can someone be more specific as how can one make the divider as part of item in ListView?
A way to do this would be to include the divider at the bottom of each row. Now you have to set the height of the divider view in your getView method in your listadapter depending of the item you are showing at the moment.
Nothing is better than explaining by picture. Here I found a screenshot from web. I made some mark on it.
This is what you want to achieve.
You can make the divider as one of the items.
Also, you can make the divider as a part of an item.
Neither of the 2 solutions uses real divider provided by ListView. It should be set 0 height. Sounds silly but it does effective.
You could set android:footerDividersEnabled to false and add dividers in your adapter.
In your ListActivity call:
ListView lv = getListView();
lv.setDivider(divider);
where divider is a Drawable object which you can define or write in your code as you need to.
You can also call:
lv.setDividerHeight(2);
To change the height

Categories

Resources