弹出窗口左侧的1px行

时间:2012-11-15 10:48:23

标签: android layout popup

  

可能重复:
  Design android popup

所以我的问题如下,我正在使用应该涵盖所有背景的弹出窗口。然而,当我加载它时左侧有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();
             }
           });

我尝试设置偏移不同的重力,但没有。

0 个答案:

没有答案