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

效果图:

6d69eeb4eef2

image.png

popupwindow布局:

xmlns:app="http://schemas.android.com/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)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值