0
How to adjust the popup window size to the layout content?
I tried, unsuccessfully, the following:
LayoutInflater inflater = (LayoutInflater) m_activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.main_info_window, null, false);
view.requestLayout();
PopupWindow pw = new PopupWindow(view,view.getWidth(),view.getHeight(),true);
main_info_window.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
android:background="#CCCCCCCC">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Info window"
android:layout_gravity="center"/>
</LinearLayout>