質問

I have a ListView, at the bottom of the screen, and each row is represented by an image, what I need here is to show a PopupWindow, at the top center part when I click on the row, kind of show some small details about it, I tried this

        image.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                View view               = mInflater.inflate(R.layout.poi_popup_info, null);

                final PopupWindow popupWindow = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, true);
                popupWindow.setBackgroundDrawable(new BitmapDrawable());
                popupWindow.showAsDropDown(image);

            }
        });

but this shows it on the bottom left corner

thank you all for your time !

役に立ちましたか?

解決 2

For those who will need this, I ended up using this library, very useful

https://github.com/shardul/Android/tree/master/ChromeStyleHelpPopups

他のヒント

Instead of PopUpWindow, give ListPopupWindow a shot.

http://developer.android.com/reference/android/widget/ListPopupWindow.html

There are lots of hooks for positioning the pop up within/around a listview

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top