We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
系统版本(必须)/ System version (required):鸿蒙3.0
库版本(必须)/ Library version (required):3.2.1
问题代码/截图(可选)/ Problem code or screenshot (optional):
报错信息(可选)/ Error reporting information (optional):
问题描述/重现步骤请写在这里 Please write the description here.
布局代码
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/transparent" android:gravity="bottom" android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/recyclerview" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="12dp" android:layout_marginEnd="12dp" android:background="@drawable/shape_list_corner_white_bg" app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" app:spanCount="2" tools:listitem="@layout/item_simple_bottom_list" /> <TextView android:id="@+id/tv_cancel" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="12dp" android:background="@drawable/shape_list_corner_white_bg" android:gravity="center" android:padding="12dp" android:text="@string/cancel" android:textColor="@color/theme_color" android:textSize="16sp" /> </LinearLayout>
Demo
package cn.chawloo.base.popup import android.content.Context import android.view.Gravity import android.view.animation.AnimationUtils import android.widget.TextView import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import cn.chawloo.base.R import cn.chawloo.base.databinding.ItemSimpleBottomListBinding import cn.chawloo.base.databinding.PopSimpleBottomListBinding import cn.chawloo.base.ext.dp import com.drake.brv.utils.divider import com.drake.brv.utils.linear import com.drake.brv.utils.setup import razerdp.basepopup.BasePopupFlag import razerdp.basepopup.BasePopupWindow /** * 多选列表弹窗 * @author Create by 鲁超 on 2020/11/20 0020 18:16 */ class BottomListPickerPopupWindow(context: Context, dataList: List<String>, picker: (String) -> Unit) : BasePopupWindow(context) { init { setContentView(R.layout.pop_simple_bottom_list) popupGravity = Gravity.BOTTOM setMaxHeight(300.dp) showAnimation = AnimationUtils.loadAnimation(context, R.anim.pop_bottom_show) dismissAnimation = AnimationUtils.loadAnimation(context, R.anim.pop_bottom_dismiss) setOverlayNavigationBar(false) findViewById<RecyclerView>(R.id.recyclerview) .linear() .divider(R.drawable.shape_rv_h_divider_1_dp) .setup { addType<String>(R.layout.item_simple_bottom_list) onBind { val binding = ItemSimpleBottomListBinding.bind(itemView) binding.tvValue.text = getModel<String>() itemView.background = when (layoutPosition) { 0 -> ContextCompat.getDrawable(context, R.drawable.shape_list_corner_white_bg) dataList.size - 1 -> ContextCompat.getDrawable(context, R.drawable.shape_list_corner_white_bg) else -> null } } onClick(R.id.tv_value) { dismiss() picker(getModel()) } }.models = dataList findViewById<TextView>(R.id.tv_cancel).setOnClickListener { dismiss() } } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
提issue前请去WIKI#常见问题查询相关问题,避免重复提问
Please go to WIKI#FAQ for relevant questions before commit your issue to avoid repetitive questions.
提issue前请务必参考以下格式填写,否则该问题会被直接关闭。
Please be sure to follow the format below before submitting the issue, otherwise the question will be actively closed!
系统版本(必须)/ System version (required):鸿蒙3.0
库版本(必须)/ Library version (required):3.2.1
问题代码/截图(可选)/ Problem code or screenshot (optional):
报错信息(可选)/ Error reporting information (optional):
布局代码
Demo
The text was updated successfully, but these errors were encountered: