android - Changes to the layout of item at position 0 of the gridview -


i have gridview inflating relativelayout. consider example of layout:

0  1  2 3  4  5 ...... ...... 

i have progress bar in layout, want apply layout @ position 0. , update using async task after adapter set. ofcourse gridview cannot access view @ position 0 , show/hide progressbar whenever gets rendered again. should in order fix layout of first child of gridview , not let change whenever user scrolls through items?

this method of getview():

public view getview(int position, view convertview, viewgroup parent) {          viewholder holder = null;         if (convertview == null) {              convertview = inflater.inflate(r.layout.gridview_tvguide, null);             holder = new viewholder();             holder.image = (imagebutton) convertview.findviewbyid(r.id.image);             holder.showtitle = (textview) convertview                     .findviewbyid(r.id.showtitle);             holder.showduration = (textview) convertview                     .findviewbyid(r.id.showtime);                     //by default visibility set gone             holder.progbar = (progressbar) convertview.findviewbyid(r.id.progressbar);             convertview.settag(holder);         }         else {             holder = (viewholder) convertview.gettag();         }              //logic control progressbar asynctask         if (this.updatenowplaying){             holder.progbar.setprogress(this.progress);             return convertview;         }          imageloader.getinstance().displayimage(                 this.shows.get(position).getshowthumb(), holder.image);         holder.showtitle.settext(this.shows.get(position).getshowtitle());         holder.showduration.settext(this.shows.get(position).getshowtime());          return convertview;     } 

edit

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/rlimage"     android:layout_width="wrap_content"     android:layout_height="200dp"     android:paddingbottom="7dp"     android:paddingright="7dp" >      <imagebutton         android:id="@+id/image"         android:layout_width="220dp"         android:layout_height="220dp"         android:adjustviewbounds="true"         android:background="@null"         android:scaletype="centercrop"         android:src="@drawable/noimage" />      <imagebutton         android:id="@+id/imagehover"         android:layout_width="220dp"         android:layout_height="220dp"         android:adjustviewbounds="true"         android:background="@null"         android:scaletype="fitxy"         android:src="@drawable/tile_selector_style" />      <textview         android:id="@+id/showtitle"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentright="true"         android:hint="show title"         android:paddingbottom="40dp"         android:paddingright="20dp"         android:singleline="true" />      <textview         android:id="@+id/showtime"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_alignparentright="true"         android:hint="show time"         android:paddingbottom="20dp"         android:paddingright="20dp"         android:singleline="true" />      <progressbar         android:id="@+id/progressbar"         style="?android:attr/progressbarstylehorizontal"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:visibility="gone"         android:layout_margin="0dp" />  </relativelayout> 

this gridview:

<gridview             android:id="@+id/gridview"             android:layout_width="0dp"             android:layout_height="match_parent"             android:cliptopadding="true"             android:columnwidth="200dp"             android:fitssystemwindows="true"             android:layout_weight="1"             android:numcolumns="auto_fit"             android:stretchmode="columnwidth" >         </gridview> 

to show progress bar item 0 add code after if/else initializing holder :

if (position == 0) {     holder.progbar.setvisibility(view.visible); } else {     holder.progbar.setvisibility(view.gone); } 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -