android - How should inflating go right way? -
i need have several listviews on scrollview android doesn't allow me decided make manually inflate listrows on vertical linearlayout, goes not right way
private void filldata(final viewgroup parent, final arraylist<person> array ){ (int i=0;i<array.size();i++){ final view view = lf.inflate(r.layout.personal_listrow, parent,true); parent.setbackgroundcolor(getactivity().getresources().getcolor(r.color.background_light_darker)); view.setbackgroundcolor(getactivity().getresources().getcolor(r.color.background_night_lighter)); textview tvname=(textview) view.findviewbyid(r.id.tvname); textview tvstatus=(textview) view.findviewbyid(r.id.tvstatus); textview tvgender=(textview) view.findviewbyid(r.id.tvgender); //fill textviews info, set onclicklisteners , on }
so - view.setbackgroundcolor paints parent . parent vertical linearlayout, view horizontal linearlayout - it's strange don't paint inflated element please explain me why
the next thing - after add array - 1st element changes , rest unchanged text. however, walked through code debugger - passes every element , sets text.
the clicklisteners works on 1st element only..
would plz explain
here's vertical , parent layout - nothing special:
<linearlayout android:id="@+id/rodll" android:layout_margintop="16dp" android:layout_marginbottom="8dp" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content">
the inflateable listrow nothing special :
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="center_vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <textview android:id="@+id/tvstatus" android:layout_width="0dp" android:layout_weight=".3" android:maxlines="1" android:layout_height="wrap_content" android:text="tvst" /> <textview android:id="@+id/tvname" android:layout_weight="1" android:layout_width="0dp" android:maxlines="1" android:layout_height="wrap_content" android:text="tvname" /> <textview android:id="@+id/tvgender" android:layout_weight=".1" android:layout_width="0dp" android:maxlines="1" android:layout_height="wrap_content" android:text="tvgender" /> <com.andexert.library.rippleview android:id="@+id/removeripple" xmlns:ripple="http://schemas.android.com/apk/res-auto" android:layout_marginleft="30dp" android:layout_width="35dp" android:layout_height="35dp" android:layout_marginright="7.5dip" android:padding="3dp" ripple:rv_alpha="255" ripple:rv_zoom="true" ripple:rv_zoomscale="0.8" ripple:rv_type="rectangle"> <imageview android:id="@+id/remove_icon" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/remove" /> </com.andexert.library.rippleview> <com.andexert.library.rippleview android:id="@+id/addripple" xmlns:ripple="http://schemas.android.com/apk/res-auto" android:layout_width="35dp" android:layout_height="35dp" android:layout_marginright="7.5dip" android:padding="3dp" ripple:rv_alpha="255" ripple:rv_zoom="true" ripple:rv_zoomscale="0.8" ripple:rv_type="rectangle"> <imageview android:id="@+id/add_icon" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/add" /> </com.andexert.library.rippleview> </linearlayout>
so. what's problem , how solve it?
Comments
Post a Comment