10
我需要能夠在listview
中點擊imgview
,這應該會打開一個彈出窗口,顯示圖像的大小。我設法實現了clicklistener
,但在創建彈出窗口時仍然失敗,即使僅使用textview
測試。Popupwindow with image
在我mainActivity的OnCreate我運行
lstView.setAdapter(new CustomListViewAdapter(this, dataFromDBListe, 0, orientation));
在我CustomListVievAdapter,在那裏我有我的clicklistener(可顯示目前舉杯)我有以下getView()
:
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.custom_row, null);
holder = new ViewHolder();
holder.title = (TextView) convertView.findViewById(R.id.title);
holder.prev = (TextView) convertView.findViewById(R.id.prevNrDate);
holder.prevTitle = (TextView) convertView.findViewById (R.id.prevTitle);
holder.next = (TextView) convertView.findViewById(R.id.nextNrDate);
holder.nextTitle = (TextView) convertView.findViewById (R.id.nextTitle);
holder.picture = (ImageView) convertView.findViewById (R.id.showPic);
holder.prevFast = (TextView) convertView.findViewById(R.id.prev);
holder.nextFast = (TextView) convertView.findViewById(R.id.next);
holder.linearLayout = (LinearLayout) convertView.findViewById (R.id.imgLay);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
testSort(holder);
final Show item = showList.get(position);
holder.title.setText(item.getTitle());
holder.prev.setText(item.getPrevNr() + " - " + item.getPrevDate());
holder.prevTitle.setText(item.getPrevTitle());
holder.next.setText(item.getNextNr() + " - " + item.getNextDate());
holder.nextTitle.setText(item.getNextTitle());
if(pic) {
holder.linearLayout.setVisibility(8);
} if(compact) {
holder.linearLayout.setVisibility(8);
holder.prevTitle.setVisibility(8);
holder.nextTitle.setVisibility(8);
} else {
// new DownloadImageTask(holder.picture).execute(item.getShowId());
String path;
if(ih.checkImg(item.getShowId())) {
path = PATH + item.getShowId() + ".jpg";
} else {
path = "bla";
}
// DrawableManager dm = new DrawableManager();
// dm.fetchDrawableOnThread(path, holder.picture);
imageDownloader.download(path, holder.picture);
// ih.download(path, holder.picture);
}
holder.picture.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Toast.makeText(context, "IMG clicked",
Toast.LENGTH_LONG).show();
//Show popup with full image of the clicked small img.
}
});
return convertView;
}
我在這裏嘗試了popupwindow的大多數常用鏈接解決方案,但無法使其工作。
這完美地工作。謝謝。 – Crunch 2011-05-18 16:36:08
@Crunch:你WC :),如果你有解決方案,你尋找tben kindly投 – Zoombie 2011-05-18 17:08:58
@ Zoombie在WhatsApp的時候,當顯示列表視圖與聯繫人,當我點擊特定聯繫人的圖像(配置文件圖片)從那裏彈出並關閉它。那麼他們使用了哪些動畫呢? – Swift 2017-02-01 06:10:07