Android 實(shí)現(xiàn)抖音頭像底部彈框效果的實(shí)例代碼
布局文件
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
點(diǎn)擊事件
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); //相對(duì)于父控件的底部顯示 無(wú)任何偏移 popWnd.showAtLocation(v, Gravity.BOTTOM, 0, 0);
到此這篇關(guān)于Android 實(shí)現(xiàn)抖音頭像底部彈框效果的文章就介紹到這了,更多相關(guān)android 抖音彈框內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- Android高德地圖marker自定義彈框窗口
- Android自定義彈框樣式
- Android啟動(dòng)頁(yè)用戶相關(guān)政策彈框的實(shí)現(xiàn)代碼
- Android中 TeaScreenPopupWindow多類型篩選彈框功能的實(shí)例代碼
- android自定義Dialog彈框和背景陰影顯示效果
- Android 提交或者上傳數(shù)據(jù)時(shí)的dialog彈框動(dòng)畫(huà)效果
- Android簡(jiǎn)單實(shí)現(xiàn)自定義彈框(PopupWindow)
- 淺析Android中常見(jiàn)三種彈框在項(xiàng)目中的應(yīng)用
- Android填坑系列:在小米系列等機(jī)型上放開(kāi)定位權(quán)限后的定位請(qǐng)求彈框示例
- Android自定義彈框Dialog效果
相關(guān)文章
Android仿微信@好友功能 輸入@跳轉(zhuǎn)、刪除整塊
這篇文章主要介紹了Android仿微信@好友功能 輸入@跳轉(zhuǎn)、刪除整塊,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-10-10通過(guò)實(shí)例簡(jiǎn)單講解Android App中的Activity組件
這篇文章主要介紹了通過(guò)Android App中的Activity組件,包括Activity的定義和繼承以及啟動(dòng)等基本知識(shí),需要的朋友可以參考下2016-04-04Android實(shí)現(xiàn)顯示和隱藏密碼功能的示例代碼
在前端中我們知道用javascript就可以可以很容易實(shí)現(xiàn)密碼的顯示與隱藏,本文將大家詳細(xì)介紹Android是如何實(shí)現(xiàn)顯示和隱藏密碼功能的,需要的可以參考一下2022-06-06Android 出現(xiàn)問(wèn)題 Gradle
這篇文章主要介紹了Android 出現(xiàn)問(wèn)題 Gradle "xxx" project refresh failed解決辦法的相關(guān)資料,需要的朋友可以參考下2017-04-04Android 詳解自定義圓角輸入框和按鈕的實(shí)現(xiàn)流程
對(duì)于安卓程序員來(lái)說(shuō),自定義view簡(jiǎn)直不要太重要,畢竟有很多功能,譬如圓形頭像這些,用單純的原生非常難以實(shí)現(xiàn),而用自定義view,簡(jiǎn)直分分鐘,今天我們來(lái)實(shí)現(xiàn)自定義圓角輸入框和按鈕,大家可以跟著練習(xí),掌握技巧2021-11-11Android Studio 一個(gè)工程打包多個(gè)不同包名的APK實(shí)例詳解
這篇文章主要介紹了Android Studio 一個(gè)工程打包多個(gè)不同包名的APK,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2018-02-02初步編寫(xiě)IDEA\AndroidStudio翻譯插件的方法
這篇文章主要介紹了初步編寫(xiě)IDEA\AndroidStudio翻譯插件,本文通過(guò)實(shí)例圖文相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-12-12Android自定義RecyclerView實(shí)現(xiàn)不固定刻度的刻度尺
這篇文章主要為大家詳細(xì)介紹了Android自定義RecyclerView實(shí)現(xiàn)不固定刻度的刻度尺,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2020-07-07Android判斷手機(jī)是否聯(lián)網(wǎng)及自動(dòng)跳轉(zhuǎn)功能(收藏版)
這篇文章主要介紹了Android判斷手機(jī)是否聯(lián)網(wǎng)及自動(dòng)跳轉(zhuǎn)功能(收藏版),在一些手機(jī)端連接wifi我們經(jīng)常會(huì)遇到這樣的功能,今天小編通過(guò)實(shí)例截圖給大家介紹下,需要的朋友可以參考下2019-11-11android開(kāi)發(fā)教程之開(kāi)機(jī)啟動(dòng)服務(wù)service示例
如果開(kāi)機(jī)啟動(dòng)一個(gè)Activity,開(kāi)機(jī)首先看的界面,是你的程序界面,如果為了,開(kāi)機(jī)后也啟動(dòng)你的程序,但是不顯示自己程序的界面,就要用Service服務(wù),下面是開(kāi)機(jī)啟動(dòng)服務(wù)service示例2014-03-03