ImageViewのサイズを再設定しようとしています。カスタムアダプタを使用しています。
View row = convertView;
if (row == null) {
LayoutInflater inflater = (LayoutInflater)
context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.grid_item, null);
}
thumb = (ImageView) row.findViewById(R.id.bookThumb);
ImageViewを使用する場合thumb=(ImageView)row.findViewById(R.id.bookThumb); カスタムアダプタ内ではうまく機能しますが、すべての行をループしているため、スクロールが非常に遅くなります。
だから...私は今thumb=(ImageView)row.findViewById(R.id.bookThumb);を取得しようとしています。メインアクティビティからサイズを設定しましたが、Nullが発生したため、アプリの強制が終了します。
試した:
LinearLayout layout = (LinearLayout) findViewById(R.id.gridLayout);
ImageView thumbRow = (ImageView)layout.findViewById(R.id.bookThumb);
また試した:
// gv is the gridview (R.id.gridview)
ImageView thumbRow = (ImageView)gv.findViewById(R.id.bookThumb);
常にnullを取得します。
助けに感謝します!私は愚かな何かを逃しているように感じます:)