Android上的图标问题';波普芬多酒店
我有一个应用程序,我正在打开一个弹出窗口,里面有一些图片、一个文本框和一个垃圾箱图标 问题是当我展示弹出窗口时,有时当我打开窗口时图标看起来很小,而在其他时候(大多数时候),图标看起来就像我定义的那样Android上的图标问题';波普芬多酒店,android,popupwindow,Android,Popupwindow,我有一个应用程序,我正在打开一个弹出窗口,里面有一些图片、一个文本框和一个垃圾箱图标 问题是当我展示弹出窗口时,有时当我打开窗口时图标看起来很小,而在其他时候(大多数时候),图标看起来就像我定义的那样 popUpView = inflater.inflate(R.layout.activity_packpresent, (ViewGroup)ma.findViewById(R.layout.activity_main)); pw = new PopupWindow( popUp
popUpView = inflater.inflate(R.layout.activity_packpresent, (ViewGroup)ma.findViewById(R.layout.activity_main));
pw = new PopupWindow(
popUpView,
ma.f.getView().getMeasuredWidth(), //400
ma.f.getView().getMeasuredHeight(), //800
true);
pw.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
System.out.println("Dismissed!!");
Handler handler = new Handler();
handler.post(new Runnable() {
@Override
public void run() {
//MainActivity.packButton.setVisibility(View.VISIBLE);
try {
image.recycle();
} catch (Exception e) {
}
ma.handlePopUpDissmiss();
}
});
}
});
trash = (ImageButton)popUpView.findViewById(R.id.trashBin);
trash.getLayoutParams().height = (int)((MainActivity.wantedPicSize)*(3.0/4.0));
trash.getLayoutParams().width = (int)((MainActivity.wantedPicSize)*(3.0/4.0));
pw.showAtLocation(map, Gravity.BOTTOM, 0, 0);
pw.update();
布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lID">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/rID"
android:background="@drawable/back5">
<ImageView
android:layout_width="125px"
android:layout_height="200px"
android:id="@+id/mImageView"
android:background="@drawable/com_facebook_picker_default_separator_color"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:layout_below="@+id/mImageView"
android:layout_marginTop="50dp"
android:editable="false"
android:visibility="visible"
android:layout_alignRight="@+id/imageViewR"
android:layout_alignEnd="@+id/imageViewR"
android:layout_alignLeft="@+id/imageViewL"
android:layout_alignStart="@+id/imageViewL" />
<ImageView
android:layout_width="125px"
android:layout_height="200px"
android:id="@+id/imageViewRR"
android:background="@drawable/com_facebook_picker_default_separator_color"
android:layout_alignTop="@+id/imageViewR"
android:layout_toRightOf="@+id/button" />
<ImageView
android:layout_width="125px"
android:layout_height="200px"
android:id="@+id/imageViewLL"
android:background="@drawable/com_facebook_picker_default_separator_color"
android:layout_alignTop="@+id/imageViewL"
android:layout_toLeftOf="@+id/button" />
<ImageView
android:layout_width="125px"
android:layout_height="200px"
android:id="@+id/imageViewR"
android:background="@drawable/com_facebook_picker_default_separator_color"
android:layout_alignTop="@+id/mImageView"
android:layout_toRightOf="@+id/mImageView" />
<ImageView
android:layout_width="125px"
android:layout_height="200px"
android:id="@+id/imageViewL"
android:background="@drawable/com_facebook_picker_default_separator_color"
android:layout_above="@+id/editText"
android:layout_toLeftOf="@+id/mImageView" />
<GridView
android:layout_width="300dp"
android:layout_height="300dp"
android:id="@+id/gridView"
android:layout_above="@+id/mImageView"
android:layout_centerHorizontal="true"
android:visibility="invisible"
android:layout_marginBottom="10dp"
android:layout_below="@+id/button2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_below="@+id/editText"
android:layout_centerHorizontal="true"
android:layout_marginTop="70dp"
android:visibility="invisible" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="10dp"
android:id="@+id/imageView"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:layout_alignRight="@+id/imageViewRR"
android:background="@drawable/line"
android:layout_alignLeft="@+id/imageViewLL"
android:layout_below="@+id/gridView" />
<Button
android:layout_width="wrap_content"
android:layout_height="20dp"
android:text="New Button"
android:id="@+id/button2"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/imageViewRR"
android:visibility="invisible" />
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/trashBin"
android:layout_below="@+id/editText"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="@drawable/trash_bin" />
</RelativeLayout>
</LinearLayout>
您可以尝试使用可在此处生成的.9补丁映像: 或者,您可以在此处使用这些图标生成器中的任何一个,并查看其是否有效:
这两个链接都非常有用。是否有关于logcat中弹出窗口的警告?为什么要玩这么多高度和宽度,有什么具体原因吗?你说的
玩这么多高度和宽度是什么意思?我想把尺寸写在我的问题上。这不对吗?