friends I have a gridview with images but when the gridview fills the emulator screen as it restarts the index because I scroll down and it no longer comes out in order that I have in the arrangement look at an image to explain better:
this is my adapter
public class adaptadorImagen extends BaseAdapter {
private Context miContext;
private Integer[] ArregloImagen = {
R.drawable.a,R.drawable.b,R.drawable.c,
R.drawable.d,R.drawable.e,R.drawable.f,
R.drawable.g,R.drawable.h,R.drawable.i,
R.drawable.j,R.drawable.k,R.drawable.l,
R.drawable.m,R.drawable.n,R.drawable.nn,
R.drawable.o,R.drawable.p,R.drawable.q,
R.drawable.r,R.drawable.s,R.drawable.t,
R.drawable.u,R.drawable.v,R.drawable.w,
R.drawable.x,R.drawable.y,R.drawable.z
};
public adaptadorImagen (Context c ) {
miContext = c;
}
@Override
public int getCount() {
return ArregloImagen.length;
}
@Override
public Object getItem(int position) {
return null;
}
@Override
public long getItemId(int position) {
return 0;
}
public int getArregloposicion(int position){return ArregloImagen[position];}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View gridv = new View(miContext);
ImageView imaView = new ImageView(miContext);
LayoutInflater inflater = (LayoutInflater) miContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
if (convertView == null) {
gridv = inflater.inflate(R.layout.pr, null);
imaView = (ImageView)gridv.findViewById(R.id.gridview_imagee);
} else {
gridv = (View) convertView;
}
imaView.setImageResource(ArregloImagen[position]);
return gridv;
}
}
this the gridview xml
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Toca Las Letras "
android:id="@+id/textView4"
android:gravity="center"
android:background="@color/accent_material_dark"
android:fontFamily="Arial Black"
android:paddingTop="5dp"
android:textStyle="bold"
android:typeface="normal"
android:textSize="30sp"
android:textColor="@color/abc_secondary_text_material_light"
android:paddingBottom="5dp" />
<GridView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/gridview"
android:columnWidth="120dp"
android:numColumns="auto_fit"
android:listSelector="#00000000"
android:stretchMode="columnWidth"
android:background="#cdcd92"
android:verticalSpacing="1dp"
android:horizontalSpacing="1dp"
android:gravity="center"
android:paddingTop="1dp">
</GridView>