Android, need to access an ImageView that has been dynamically created with addView() -


here trying -

slider title

while there many parts go think problems go away if reference dynamically created imageviews in code below. accomplish in pic have been trying use horizontalsrcollview. code dynamically create imageviews -

        (int j = 1; j < cr_count + 1; j++) {         linearlayout l = (linearlayout) findviewbyid(r.id.list);         comp_hsv =                 (horizontalscrollview) findviewbyid(r.id.scroller);         imageview = new imageview(getapplicationcontext());         i.setimageresource(android.r.drawable.btn_star_big_on);         l.addview(i);          comp_hsv.fullscroll(horizontalscrollview.focus_left);     } 

my.xml -

            <horizontalscrollview             android:id="@+id/scroller"             android:layout_width="200dp"             android:layout_height="75dp"             android:scrollbarsize="50dp"             android:layout_alignparentbottom="true"             android:layout_centerhorizontal="true">              <linearlayout                 android:id="@+id/list"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:padding="20dp"                 android:orientation="horizontal"                 android:layout_alignparentbottom="true"                 android:layout_centerhorizontal="true" />          </horizontalscrollview>  

i have been running on internet trying work , no luck. suggestions/help awesome.

i'd prefer viewpager better solution. however, in case cant change of code, might try inexpensive code.

list<imageview> refs = new arraylist<imageview>();  (int j = 1; j < cr_count + 1; j++) {     linearlayout l = (linearlayout) findviewbyid(r.id.list);     comp_hsv = (horizontalscrollview) findviewbyid(r.id.scroller);     imageview = new imageview(getapplicationcontext());     i.setimageresource(android.r.drawable.btn_star_big_on);     l.addview(i);  --> refs.add(i);      comp_hsv.fullscroll(horizontalscrollview.focus_left); } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -