小编che*_*han的帖子

我想根据android中的标题大小在运行时设置弹出窗口宽度

我尝试了很多东西,但没有得到任何解决方案,我在运行时设置文本,我需要弹出的宽度根据文本大小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)

android popup popupwindow android-layout

7
推荐指数
1
解决办法
1万
查看次数

我使用谷歌mapV2和我从谷歌地方api下载图像,并希望在弹出窗口中显示

即时通讯使用所有类来通过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下载的图像.

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.InfoWindowAdapter

即时通讯使用infowindowAdapter类goolge,它说我在窗口中加载数据和图像时不会改变图像,这就是为什么它显示第一个默认图像.....并且以后不再改变

还有其他方法吗?提前致谢

android google-maps popupwindow

1
推荐指数
1
解决办法
1826
查看次数