Java 为什么我的弹出窗口不是';没有显示?
我有这门课Java 为什么我的弹出窗口不是';没有显示?,java,android,android-layout,android-popupwindow,Java,Android,Android Layout,Android Popupwindow,我有这门课 public class ShareTooltip extends PopupWindow { public ShareTooltip(Context context, ViewGroup rootView) { super(); this.mContext = context; this.mParentRoot = rootView; this.mViewToPointAt = mParentRoot.findViewById(R.id.bot
public class ShareTooltip extends PopupWindow {
public ShareTooltip(Context context, ViewGroup rootView) {
super();
this.mContext = context;
this.mParentRoot = rootView;
this.mViewToPointAt = mParentRoot.findViewById(R.id.bottomBarFollowers);
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mPopUpRoot = (LinearLayout) inflater.inflate(R.layout.tooltip_share, null);
setContentView(mPopUpRoot);
}
// The method that displays the popup.
public void showPopup() {
mPopUpRoot.setVisibility(View.VISIBLE);
mPopUpRoot.bringToFront();
showAtLocation(mParentRoot, Gravity.NO_GRAVITY, 10, 10);
}
}
我正在调用showPopup()
,但是我没有看到弹出窗口
我应该找什么
这是我的xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<!--
android:background="#2278E700">
-->
<LinearLayout
android:id="@+id/tooltip_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/tip_tool_top_left"
android:gravity="top|left"
android:orientation="horizontal"
android:layout_marginTop="0dp"
android:paddingBottom="20dp"
android:paddingTop="10dp"
android:paddingLeft="0dp"
android:paddingRight="25dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:src="@drawable/tip_tool_icon_light_bulb" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
显示您的工具提示\u共享。xml@Suvitruf我已经加上了。谢谢你重命名了xml。xml中的id是工具提示而不是工具提示_share@Byronxml名称是
tooltip\u share.xml
,而rootLayout是tooltip\u layout
LayoutInflater inflater =
(LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout viewGroup = (LinearLayout) mContext.findViewById(R.id.tooltip_layout);
mPopUpRoot = (LinearLayout) inflater.inflate(R.layout.tooltip_share, viewGroup);
setContentView(mPopUpRoot);