最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android 實現(xiàn)抖音頭像底部彈框效果的實例代碼

 更新時間:2020年04月21日 15:51:51   作者:迷路國王  
這篇文章主要介紹了Android 實現(xiàn)抖音頭像底部彈框效果,本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

布局文件

activity_test.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  xmlns:app="http://schemas.android.com/apk/res-auto">



  <LinearLayout
    android:id="@+id/linearLayout"
    android:orientation="vertical"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    android:background="@color/colorAccent"
    android:layout_width="match_parent"
    android:layout_height="300dp">
  </LinearLayout>
  <View
    android:layout_width="match_parent"
    android:layout_height="100dp"
    app:layout_constraintTop_toTopOf="@+id/linearLayout"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    android:alpha="0"
    android:background="@android:color/white"
    />
  <ImageView
    android:id="@+id/image"
    android:src="@mipmap/ic_launcher"
    app:layout_constraintTop_toTopOf="@+id/linearLayout"
    app:layout_constraintBottom_toTopOf="@+id/linearLayout"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    android:layout_marginTop="100dp"
    android:layout_width="100dp"
    android:layout_height="100dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>

MainActivity.java

點擊事件

View contentView = LayoutInflater.from(MainActivity.this).inflate(R.layout.activity_test, null);
        PopupWindow popWnd = new PopupWindow(MainActivity.this);
        popWnd.setContentView(contentView);
        popWnd.setWidth(ViewGroup.LayoutParams.MATCH_PARENT);
        popWnd.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
        popWnd.setBackgroundDrawable(new ColorDrawable(0x00000000));
        popWnd.setOutsideTouchable(false);
        popWnd.setFocusable(true);
        //相對于父控件的底部顯示 無任何偏移
        popWnd.showAtLocation(v, Gravity.BOTTOM, 0, 0);

在這里插入圖片描述

到此這篇關(guān)于Android 實現(xiàn)抖音頭像底部彈框效果的文章就介紹到這了,更多相關(guān)android 抖音彈框內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

孝感市| 大悟县| 上思县| 西林县| 册亨县| 辉县市| 滦平县| 彭水| 盈江县| 锦州市| 南宁市| 来凤县| 铁岭县| 平远县| 鄂尔多斯市| 广灵县| 西昌市| 花莲市| 长海县| 万盛区| 曲麻莱县| 武义县| 遂川县| 桂东县| 西吉县| 房产| 万载县| 梓潼县| 庆云县| 凤翔县| 合水县| 通河县| 焦作市| 北票市| 伊金霍洛旗| 宁明县| 彭州市| 武平县| 新化县| 平武县| 津南区|