300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > android半透明圆形按键 android popupwind背景半透明recycleview底部圆角

android半透明圆形按键 android popupwind背景半透明recycleview底部圆角

时间:2020-03-30 01:29:57

相关推荐

android半透明圆形按键 android popupwind背景半透明recycleview底部圆角

效果图:

image.png

popupwindow布局:

xmlns:app="/apk/res-auto"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/tran_50"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="@dimen/dp_1"

android:background="@color/hui_d8" />

android:id="@+id/rvList"

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:background="@color/white"

android:overScrollMode="never" />

android:layout_width="match_parent"

android:layout_height="@dimen/dp_10"

android:background="@drawable/white_bottom_cricle_shape" />

android:id="@+id/emptyView"

android:layout_width="match_parent"

android:layout_height="wrap_content"/>

white_bottom_cricle_shape

android:shape="rectangle">

popupwindow

import android.content.Context

import android.view.LayoutInflater

import android.view.View

import android.view.ViewGroup

import android.widget.PopupWindow

import androidx.recyclerview.widget.DividerItemDecoration

import androidx.recyclerview.widget.LinearLayoutManager

import androidx.recyclerview.widget.RecyclerView

class StorePopupwindow(var context: Context, var listener:onAdapterAnyListener) : PopupWindow(),onAdapterAnyListener {

var rvList:RecyclerView? = null

var applyAdapter:StoreListAdapter? = null

var emptyView:View? = null

override fun onAdapterViewClick(postion: Int, data1: Any?, data2: Any?, data3: Any?) {

listener?.onAdapterViewClick(postion,data1,data2,data3)

this.dismiss()

}

init {

width = ViewGroup.LayoutParams.MATCH_PARENT

height = ViewGroup.LayoutParams.WRAP_CONTENT

isOutsideTouchable = true

val view = LayoutInflater.from(context).inflate(R.layout.popupwind_store_view,null,false)

rvList = view.findViewById(R.id.rvList)

emptyView = view.findViewById(R.id.emptyView)

contentView = view

applyAdapter = StoreListAdapter(context)

applyAdapter?.setAdapterClickListener(this)

val lm = LinearLayoutManager(context)

lm.orientation = LinearLayoutManager.VERTICAL

rvList?.let {

with(it){

layoutManager = lm

addItemDecoration(DividerItemDecoration(this.context, DividerItemDecoration.VERTICAL))

adapter = applyAdapter

}

}

emptyView?.setOnClickListener { this.dismiss() }

}

}

显示在某个view下面

val popupWindow = StorePopupwindow(this,this)

popupWindow.showAsDropDown(rlStoreLay,0,0)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。