【发布时间】:2014-01-09 21:25:26
【问题描述】:
我已经看到很多关于通过将 null 或 new Drawable() 传递给 setBackgroundDrawable() 来移除 PopupWindow 边框的问题。我遇到了相反的问题。我想要我的 PopupWindow 周围的边框,最好有一个指向我的锚点的工具提示箭头。目前,我的 PopupWindow 没有边框。我尝试调整边距、xml 中的背景、布局的宽度和高度、列表视图和列表视图行,但无济于事。有人可以帮我在顶部获得边框和图像吗?我正在尝试使用 android SDK。
popup_menu_list.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<com.github.jeremiemartinez.refreshlistview.RefreshListView
android:id="@+id/popup_menu_list_listview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/color_white" />
</LinearLayout>
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);
}
我只是将这些作为示例,但我想要这样的东西,弹出窗口指向锚点:
但我得到这样的东西:
【问题讨论】:
-
编辑了所需的 PopupWindow 外观示例
标签: android popupwindow