我尝试了很多东西,但没有得到任何解决方案,我在运行时设置文本,我需要弹出的宽度根据文本大小LinearLayout viewGroup =(LinearLayout)((Activity)context).findViewById(R.id.popup);
LayoutInflater layoutInflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(R.layout.popup_layout, viewGroup);
title_tv = (TextView) layout.findViewById(R.id.popup_txt);
title_tv.setText(title_P);
PopupWindow popup = new PopupWindow(context);
final float SCALE = layout.getResources().getDisplayMetrics().density;
int mode = MeasureSpec.getMode(View.MeasureSpec.UNSPECIFIED);
int measuredWidth = MeasureSpec.getSize(View.MeasureSpec.UNSPECIFIED);
popup.setWidth(measuredWidth);
popup.setHeight(60);
popup.setContentView(layout);
//popup.setWindowLayoutMode();
popup.setFocusable(true);
Run Code Online (Sandbox Code Playgroud) 即时通讯使用所有类来通过URL设置图像.
ImageView imV= ((ImageView) view.findViewById(R.id.badge));
// Image url
String image_url = "http://maps.gstatic.com/mapfiles/place_api/icons/cafe-71.png";
final int stub_id = R.drawable.ic_action_search;
// ImageLoader class instance
ImageLoader imgLoader = new ImageLoader(getApplicationContext());
// whenever you want to load an image from url
// call DisplayImage function
// url - image url to load
// loader - loader image, will be displayed before getting image
// image - ImageView
imgLoader.DisplayImage(image_url,stub_id ,imV);
Run Code Online (Sandbox Code Playgroud)
但它显示的是默认图像,而不是Url下载的图像.
即时通讯使用infowindowAdapter类goolge,它说我在窗口中加载数据和图像时不会改变图像,这就是为什么它显示第一个默认图像.....并且以后不再改变
还有其他方法吗?提前致谢