android - Can't set height and width of Popup Window -
i made layout popup window , when click on button display popup window doesn't show popup dialog correctly , partial view seen this
when click on 3 dots.
i want popup display this
when click on 3 dots.
here code.
layoutinflater layoutinflater = (layoutinflater)getbasecontext() .getsystemservice(layout_inflater_service); final view popupview = layoutinflater.inflate(r.layout.custom_dialog, null); final popupwindow popupwindow = new popupwindow( popupview, windowmanager.layoutparams.wrap_content, windowmanager.layoutparams.wrap_content); imagebutton gmail= (imagebutton) popupview.findviewbyid(r.id.gmail); gmail.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { popupwindow.dismiss(); } }); popupwindow.showasdropdown(view.findviewbyid(r.id.more));
xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1"> <imagebutton android:id="@+id/gmail" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scaletype="fitxy" app:srccompat="@drawable/gmail" android:backgroundtint="#000000" android:layout_weight="0.25"/> <imagebutton android:id="@+id/hike" android:layout_width="wrap_content" android:layout_height="wrap_content" app:srccompat="@drawable/hike" android:backgroundtint="#000000" android:scaletype="fitxy" android:layout_weight="0.25"/> <imagebutton android:id="@+id/hangouts" android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundtint="#000000" app:srccompat="@drawable/hangouts" android:scaletype="fitxy" android:layout_weight=".25"/> <imagebutton android:id="@+id/message" android:layout_width="wrap_content" android:layout_height="wrap_content" app:srccompat="@drawable/message" android:scaletype="fitxy" android:backgroundtint="#000000" android:layout_weight=".25"/> </linearlayout>
can tell me made mistake? in advance. thank people help
replace app:srccompat="@drawable/hike"
android:src="@drawable/hike"
Comments
Post a Comment