zoukankan      html  css  js  c++  java
  • PopupWindow分享页面

    效果图

    步骤:

    1.布局中添加分享按钮

    2.画出分享页面

    3.设置分享页面animator进出动画,并在style.xml中配置

    4.MainActivity中添加方法

    *画出布局

    主页面:
    <Button
        android:id="@+id/share"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="分享"
        android:onClick="share"/>
        
    分享页面:
    <TextView
        android:id="@+id/textview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="share"
        android:textSize="30sp" />    

    *设置动画效果

    //in.xml
    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <translate android:duration = "1000"
            android:fromYDelta="100%"
            android:toYDelta="0"></translate>
    </set>
    
    //out.xml
    <set xmlns:android="http://schemas.android.com/apk/res/android">
        <translate android:duration = "1000"
            android:fromYDelta="0"
            android:toYDelta="100%"></translate>
    </set>
    
    //styles.xml
    <style name="my_popupWindow_style">
        <item name="android:windowEnterAnimation">@animator/in</item>
        <item name="android:windowExitAnimation">@animator/out</item>
    </style>

    *MainActivity添加方法

    public void share(View view) {
        View shareView = LayoutInflater.from(this).inflate(R.layout.popupwindow_share, null);
        PopupWindow popupWindow = new PopupWindow(shareView, LinearLayout.LayoutParams.MATCH_PARENT,200);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setFocusable(true);
        popupWindow.setBackgroundDrawable(new BitmapDrawable());
        popupWindow.setAnimationStyle(R.style.my_popupWindow_style);
        popupWindow.showAtLocation(view, Gravity.BOTTOM,0,0);
    }

     

  • 相关阅读:
    视图
    过滤器
    Redis--事务
    Redis--发布订阅
    Redis--有序集合(sorted set)
    Redis--集合(Set)
    Redis--列表(List)
    TeamViewer安装使用
    loadrunner获取当前CST时间
    LR录制Flex+Web,登录功能之登录密码出错的处理
  • 原文地址:https://www.cnblogs.com/anni-qianqian/p/5442103.html
Copyright © 2011-2022 走看看