我看到很多关于通过传递null或新的Drawable()到setBackgroundDrawable()删除PopupWindow的边框的问题。我有相反的问题。我想在我的PopupWindow周围的边框,最好用一个工具提示箭头指向我的锚。目前,我的PopupWindow没有边框。我已经尝试调整边距,在xml中的背景,布局,列表视图和列表视图行的宽度和高度无效。有人可以帮助我得到一个边框和顶部的图像吗?我试图坚持与这个Android SDK。
popup_menu_list.xml
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
android:id="@+id/popup_menu_list_listview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/color_white" />
Java
private void displayPopupMenu() {
LayoutInflater layoutInflater = getLayoutInflater();
View popupView = layoutInflater.inflate(R.layout.popup_menu_list, null);
final PopupWindow popupWindow = new PopupWindow(popupView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
RefreshListView myListView = (RefreshListView) popupView.findViewById(R.id.popup_menu_list_listview);
mAdapter = new myAdapter(this, getAdapterData());
myListView.setAdapter(mAdapter);
popupWindow.showAsDropDown(mMyAnchor);
}
我只是抓住这些作为例子,但我想要这样的弹出指向锚点:
但我得到这样的东西: