0

重複の可能性:
Android ポップアップの設計

私の問題は次のとおりです。すべての背景をカバーするポップアップを使用しています。しかし、私がそれをロードすると、カバーされていない左側に 1px の行があります。リンク: http://shrani.si/f/1a/GT/PuzRGJv/screenshot2012-11-15-11-.png . 私のxml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="@+id/popup"
android:layout_height="match_parent"
android:background="#BFBFBF"
android:orientation="vertical" >
 <RelativeLayout
 android:layout_width="match_parent"
 android:layout_height="match_parent" >


<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="280dp"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:background="@drawable/popup_round_corners"
    android:orientation="vertical"
    android:padding="10dp" >

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:text="@string/zm_main_uvod"
        android:textColor="#6e9046"
        android:textStyle="bold" />

    <ImageButton
        android:id="@+id/close"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:background="@null"
        android:paddingLeft="3dp"
        android:paddingRight="3dp"
        android:src="@drawable/btn_ok" />
</LinearLayout>

</RelativeLayout>

 </LinearLayout>

ポップアップを表示する私のコード:

LinearLayout viewGroup = (LinearLayout)findViewById(R.id.popup);
       LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
       View layout = layoutInflater.inflate(R.layout.startpopup, viewGroup);

       final PopupWindow popup = new PopupWindow(context);
       popup.setContentView(layout);
       Display display = getWindowManager().getDefaultDisplay(); 
       int width = display.getWidth();
       int height=display.getHeight();
       popup.setWidth(width+5);
       popup.setHeight(height+5);
       popup.setFocusable(true);
       popup.showAtLocation(layout, Gravity.NO_GRAVITY, 0, 0);
       ImageButton close = (ImageButton) layout.findViewById(R.id.close);
           close.setOnClickListener(new OnClickListener() {

             @Override
             public void onClick(View v) {
               popup.dismiss();
             }
           });

オフセットの異なる重力を設定しようとしましたが、何もしませんでした。

4

0 に答える 0