美文网首页
QMUI使用笔记

QMUI使用笔记

作者: 逍遥才子 | 来源:发表于2020-03-01 15:00 被阅读0次
  1. QMUIPopup
mNormalPopup = QMUIPopups.popup(getContext(), QMUIDisplayHelper.dp2px(getContext(), 250))
                .preferredDirection(QMUIPopup.DIRECTION_BOTTOM)
                .view(textView)
                .edgeProtection(QMUIDisplayHelper.dp2px(getContext(), 20))
                .dimAmount(0.6f)
                .animStyle(QMUIPopup.ANIM_GROW_FROM_CENTER)
                .onDismiss(new PopupWindow.OnDismissListener() {
                    @Override
                    public void onDismiss() {
                        Toast.makeText(getContext(), "onDismiss", Toast.LENGTH_SHORT).show();
                    }
                })
                .show(v);
  1. QMUIBottomSheet


    image.png
private fun showSimpleBottomSheetGrid() {
        val FIRST_CHOOSE = 0
        val REPEAT = 1
        val EXCEPT = 2
        val builder = QMUIBottomSheet.BottomGridSheetBuilder(this)
        builder.addItem(R.drawable.qmui_icon_choose_first, "优选", FIRST_CHOOSE, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE)
                .addItem(R.drawable.qmui_icon_repeat, "重复", REPEAT, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE)
                .addItem(R.drawable.qmui_icon_except, "屏蔽", EXCEPT, QMUIBottomSheet.BottomGridSheetBuilder.FIRST_LINE)
                .setAddCancelBtn(true)
                .setOnSheetItemClickListener { dialog, itemView ->
                    dialog.dismiss()
                    val tag = itemView.tag as Int
                    when (tag) {
                        FIRST_CHOOSE -> toast("优选")
                        REPEAT -> toast("重复")
                        EXCEPT -> toast("屏蔽")
                    }
                }.build().show()


    }
  1. QMUITipDialog
protected void showLoading(){
        if (loadingDialog==null)
            loadingDialog = new QMUITipDialog.Builder(getContext())
                    .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
                    .setTipWord("正在加载")
                    .create();
        loadingDialog.show();
    }

4.QMUIRoundRelativeLayout

<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundRelativeLayout
                android:layout_width="match_parent"
                android:layout_height="44dp"
                android:layout_marginTop="23dp"
                android:paddingLeft="30dp"
                android:paddingRight="30dp"
                app:qmui_backgroundColor="@color/round_btn_bg6"
                app:qmui_isRadiusAdjustBounds="true">

                <TextView
                    android:id="@+id/country_tv"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:drawablePadding="4dp"
                    android:text="+86"
                    android:background="?android:attr/selectableItemBackground"
                    android:textColor="@color/title_text1"
                    android:textSize="14sp" />

                <View
                    android:id="@+id/view_space"
                    android:layout_width="1dp"
                    android:layout_height="10dp"
                    android:layout_centerVertical="true"
                    android:layout_marginLeft="12dp"
                    android:layout_marginRight="12dp"
                    android:layout_toEndOf="@id/country_tv"
                    android:background="@color/title_text1" />

        
            </com.qmuiteam.qmui.widget.roundwidget.QMUIRoundRelativeLayout>
  1. QMUIRoundButton
<com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton
            android:id="@+id/login_iv"
            android:layout_width="match_parent"
            android:layout_height="44dp"
            android:layout_marginTop="19dp"
            android:enabled="false"
            android:text="@string/login"
            android:textColor="@android:color/white"
            android:visibility="visible"
            app:qmui_backgroundColor="@color/colorPrimaryDark" />

6.工具

//隐藏键盘
QMUIKeyboardHelper.hideKeyboard(loginIv);
//设置状态栏mode
QMUIStatusBarHelper.setStatusBarDarkMode(this);
//沉浸式状态栏
 QMUIStatusBarHelper.translucent(this);
  1. tab
 <com.qmuiteam.qmui.widget.tab.QMUITabSegment
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:layout_gravity="bottom"
        android:background="@color/white"
        android:textSize="12sp"
        app:qmui_tab_icon_position="top"
        app:qmui_tab_has_indicator="false"
        app:qmui_tab_normal_text_size="12sp"
        app:qmui_tab_selected_text_size="14sp"
        app:qmui_topDividerColor="@color/white"
        app:qmui_topDividerHeight="1px" />


val builder = tabs.tabBuilder()
            builder.setSelectedIconScale(1f)
                    .setTextSize(QMUIDisplayHelper.sp2px(this, 13), QMUIDisplayHelper.sp2px(this, 13))
                    .setDynamicChangeIconColor(false)
                    .skinChangeWithTintColor(false)
            
            val home = builder
                    .setNormalDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_home))
                    .setSelectedDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_home_select))
                    .setText("首页")
                    .build(this)
            val order = builder
                    .setNormalDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_schedule))
                    .setSelectedDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_schedule_select))
                    .setText("约课")
                    .build(this)
            val table = builder
                    .setNormalDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_table))
                    .setSelectedDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_table_select))
                    .setText("课表")
                    .build(this)
            val afterclass = builder
                    .setNormalDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_list))
                    .setSelectedDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_list_select))
                    .setText("课后单")
                    .build(this)
            val mine = builder
                    .setNormalDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_mine))
                    .setSelectedDrawable(ContextCompat.getDrawable(this, peilian.R.drawable.qmui_home_icon_mine_select))
                    .setText("我的")
                    .build(this)

            tabs.addTab(home)
                    .addTab(order)
                    .addTab(table)
                    .addTab(afterclass)
                    .addTab(mine)

相关文章

网友评论

      本文标题:QMUI使用笔记

      本文链接:https://www.haomeiwen.com/subject/spxmqhtx.html