zoukankan      html  css  js  c++  java
  • popUpWindow 动画无法超出窗体的解决方案

    popupWindow 做动画时,当要求有一个放大动画时,动画无法超出窗体,给人的感觉是只有内容在放大,窗体不动。

    这是由于窗口大小固定的原因,解决方案是加大popUpwindow的 大小。

    一个比较省事儿的方案是,直接把popupwindow窗体设为全屏和透明。这样你就可以任意玩了。这种方案的缺点是 弹窗的位置无法用自带的方法设置。

    另外点击窗口外弹窗消失也没法实现了。所以最好的解决方案是,弹窗的大小稍微大于view的大小。

    目前的处理办法是,在做popview布局时在外面套一个空布局,然后在内层布局中设置一定的margin值。这样也不会屏蔽掉点击外部退出弹窗的效果。代码如下:

    <?xml version="1.0" encoding="utf-8"?>
    //套一个空布局
    <com.zhy.autolayout.AutoRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        >
        <com.zhy.autolayout.AutoLinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:layout_marginLeft="10dp"//设置margin值,由于我的效果是贴着右上角弹出来,所以右面和上面margin值设置小一点,或者不设置(紧贴)
            android:layout_marginRight="2dp"
            android:layout_marginTop="2dp"
            android:background="@drawable/pop_bg_shape"
            android:orientation="vertical">
            <TextView
                android:id="@+id/tv_createFolder"
                android:layout_width="224px"
                android:layout_height="68px"
                android:gravity="center"
                android:text="新建文件夹"
                android:textColor="@color/button_textColor"
                android:textSize="24px" />
  • 相关阅读:
    2019.9.4 二维树状数组
    2019.9.4 简单题
    0052-YH的计算器
    0051-打乱顺序的三位数
    0050-计算天数
    0049-学校的上网费
    0048-三角形的判断
    0047-月份转换
    0046-简单的分段函数(二)
    0045-简单的分段函数(一)
  • 原文地址:https://www.cnblogs.com/epmouse/p/5726722.html
Copyright © 2011-2022 走看看