PopupWindow部分手机设置高度无效,一直全屏

本文仅记录项目所遇问题
原因:布局问题
1、原布局
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ll_menu"
    android:background="@color/white"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/gray_f7"
            android:padding="12dp">

            <RelativeLayout
                android:id="@+id/rl_left"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toLeftOf="@+id/tv_choose"
                android:background="@color/gray_f7">

                <TextView
                    android:id="@+id/tv_left"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginRight="50dp"
                    android:layout_weight="1"
                    android:background="@mipmap/ic_go_left" />
            </RelativeLayout>

            <TextView
                android:id="@+id/tv_choose"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:text="2018-06"
                android:textColor="@color/black_33"
                android:textSize="16sp" />

            <RelativeLayout
                android:id="@+id/rl_right"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/tv_choose"
                android:background="@color/gray_f7">

                <TextView
                    android:id="@+id/tv_right"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginLeft="50dp"
                    android:layout_weight="1"
                    android:background="@mipmap/ic_go_right_1" />
            </RelativeLayout>
        </RelativeLayout>

        <GridView
            android:id="@+id/gridView_date"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:numColumns="4"
            android:paddingHorizontal="5dp"
            android:paddingVertical="15dp" />
</LinearLayout>

2、修改后布局

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

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/gray_f7"
            android:padding="12dp">

            <RelativeLayout
                android:id="@+id/rl_left"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toLeftOf="@+id/tv_choose"
                android:background="@color/gray_f7">

                <TextView
                    android:id="@+id/tv_left"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginRight="50dp"
                    android:layout_weight="1"
                    android:background="@mipmap/ic_go_left" />
            </RelativeLayout>

            <TextView
                android:id="@+id/tv_choose"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:text="2018-06"
                android:textColor="@color/black_33"
                android:textSize="16sp" />

            <RelativeLayout
                android:id="@+id/rl_right"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@+id/tv_choose"
                android:background="@color/gray_f7">

                <TextView
                    android:id="@+id/tv_right"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerHorizontal="true"
                    android:layout_marginLeft="50dp"
                    android:layout_weight="1"
                    android:background="@mipmap/ic_go_right_1" />
            </RelativeLayout>
        </RelativeLayout>

        <GridView
            android:id="@+id/gridView_date"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:numColumns="4"
            android:background="@color/white"
            android:paddingHorizontal="5dp"
            android:paddingVertical="15dp" />
   
</LinearLayout>

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值