How to set each and every row of a ListView to transparent in Android? -
i have listview
in rows generated using simpleadapter
. have 3 textviews
, 2 imageviews
in it. have set background of listview
android:background="@drawable/backgnd"
.the textview's background set following android:background="#20535252"
. getting nice glass/transparent kind of background textviews placed, don't glass background @ whole row of listview. can suggest me solution this.
hi depends on color choosing in layouts , can modify color transparent adjusting the values below
android:background="#80xxxxxx" (or) bg.setcolor(color.argb(128, xxx, xxx, xxx)); (or) android:background="@android:color/transparent"
use , in xxxxx fields add ground color give smooth glass color backgrounds... best...
this custom adapter use have used layouts in adapter put custom layout in adapter
customadapter madapter = new customadapter(this, r.layout.listitem, mlistitems); mpullrefreshlistview.setadapter(madapter);
and use custom adapter in project
and don't forgot suggested above color use color in list item background will
your desired background
public class customadapter extends arrayadapter<sample> { public arraylist<sample> mlist; public context context; public layoutinflater inflater; public customadapter(context context, int resource, arraylist<sample> mlist) { super(context, resource); this.mlist = mlist; this.context = context; inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); } @override public int getposition(sample item) { return super.getposition(item); } @override public sample getitem(int position) { return mlist.get(position); } @override public int getcount() { return mlist.size(); } @override public long getitemid(int position) { return super.getitemid(position); } @override public view getview(int position, view convertview, viewgroup parent) { convertview = inflater.inflate(r.layout.listitem, null); //replace here layout textview text1 = (textview) convertview.findviewbyid(r.id.item1); textview text2 = (textview) convertview.findviewbyid(r.id.item2); text1.settext(mlist.get(position).getlistitem1()); text2.settext(mlist.get(position).getlistitem2()); text2.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { // put logic here , use custom adapter // load data using particular custom adapter // listview } }); return convertview; } }
Comments
Post a Comment