0
У меня возникли трудности с макетами Android, я чувствую, что он держит случайным щелчком/изменением размера/перемещением. Я пытаюсь достичь этого конкретного макета, но я не понимаю, как это сделать.План Android: как достичь этого конкретного вида?
Любая помощь/советы в достижении этой макет будет оценен по достоинству!
Это код, который я пробовал:
public class ImageAdapter extends BaseAdapter {
private Context mContext;
// Constructor
public ImageAdapter(Context c) {
mContext = c;
}
public int getCount() {
return mThumbIds.length;
}
public Object getItem(int position) {
return null;
}
public long getItemId(int position) {
System.out.println(position);
return 0;
}
// create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView;
int imgSize = 0;
if (convertView == null) {
WindowManager wm = (WindowManager) mContext
.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
imgSize = size.x/4;
imageView = new ImageView(mContext);
imageView.setLayoutParams(new GridView.LayoutParams(imgSize,
imgSize));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
} else {
imageView = (ImageView) convertView;
}
imageView.setImageResource(mThumbIds[position]);
imageView.setLayoutParams(new GridView.LayoutParams(imgSize * 2,
imgSize * 2));
imageView.setImageResource(mThumbIds2[0]);
return imageView;
}
// Keep all Images in array
public Integer[] mThumbIds = { R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic, R.drawable.yourpic,
R.drawable.yourpic, R.drawable.yourpic };
public Integer[] mThumbIds2 = { R.drawable.bigpicture };
}
Это выглядит как GridLayout или TableLayout –
я добавил код, который я пытался ОП. – StackPWRequirmentsAreCrazy