popupwindow加白色背景框后,边缘出现黑线,怎么才能去掉,求各位大侠帮忙
代码:
public class MusicPopup2 {
private PopupWindow music;
private View vt;
private Context context;
private int width=70;
private int height=145;
public MusicPopup2(Context c) {
context = c;
View ebook_popwindow_music = View.inflate(context, R.layout.popup, null);
//R.layout.popup是一个带背景的LinearLayout
music = new PopupWindow(ebook_popwindow_music, width,height);
}
public void show(View parent) {
vt=parent;
music.showAtLocation(vt, 0, 580, 809);
}
}
代码:
public class MusicPopup2 {
private PopupWindow music;
private View vt;
private Context context;
private int width=70;
private int height=145;
public MusicPopup2(Context c) {
context = c;
View ebook_popwindow_music = View.inflate(context, R.layout.popup, null);
//R.layout.popup是一个带背景的LinearLayout
music = new PopupWindow(ebook_popwindow_music, width,height);
}
public void show(View parent) {
vt=parent;
music.showAtLocation(vt, 0, 580, 809);
}
}
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="70px"
android:layout_height="145px"
android:orientation="vertical"
android:background="@drawable/musicback">
<LinearLayout
android:layout_width="70px"
android:layout_height="137px"
android:orientation="vertical">
<ImageButton
android:id="@+id/imagebutton_ebook_popwindow_bottomtitle_random"
android:layout_height="58px"
android:layout_width="58px"
android:layout_marginLeft="8px"
android:layout_marginTop="5px"
android:background="@drawable/random1"
></ImageButton>
<ImageButton
android:id="@+id/imagebutton_ebook_popwindow_bottomtitle_repeat"
android:layout_height="58px"
android:layout_width="58px"
android:layout_marginLeft="8px"
android:layout_marginTop="5px"
android:background="@drawable/repeat1"
></ImageButton>
</LinearLayout>
</LinearLayout>
一般布局出现的东西不干代码的事..
再把popupwindow的高度改成自适应来适应它
应该就可以了。。
personal_popupWindow=new PopupWindow(this.getLayoutInflater().inflate(R.layout.personal_popupwindow, null),
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
如果这样不行就是你布局有问题了
popupWindow.setBackgroundDrawable(null);