<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          SwipeRefreshDemo仿QQ消息控件

          聯(lián)合創(chuàng)作 · 2023-09-24 08:49

          SwipeRefreshDemo

          自定義組合控件上拉+下拉+左滑刪除置頂

          look at the screenshot:

          高仿微信群聊頭像

          使用方法

          build.gradle文件

          compile 'com.hankkin:swiperefresh:1.0.1

          xml引用

           <com.hankkin.library.RefreshSwipeMenuListView
                  android:id="@+id/swipe"
                  android:dividerHeight="1dp"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"/>

          創(chuàng)建左滑菜單

                rsmLv.setAdapter(adapter);
                  rsmLv.setListViewMode(RefreshSwipeMenuListView.HEADER);
                  rsmLv.setOnRefreshListener(this);
          
                  SwipeMenuCreator creator = new SwipeMenuCreator() {
                      @Override
                      public void create(SwipeMenu menu) {
                          // 創(chuàng)建滑動選項
                          SwipeMenuItem rejectItem = new SwipeMenuItem(
                                  getApplicationContext());
                          // 設(shè)置選項背景
                          rejectItem.setBackground(new ColorDrawable(getResources().getColor(R.color.top)));
                          // 設(shè)置選項寬度
                          rejectItem.setWidth(dp2px(80,getApplicationContext()));
                          // 設(shè)置選項標(biāo)題
                          rejectItem.setTitle("置頂");
                          // 設(shè)置選項標(biāo)題
                          rejectItem.setTitleSize(16);
                          // 設(shè)置選項標(biāo)題顏色
                          rejectItem.setTitleColor(Color.WHITE);
                          // 添加選項
                          menu.addMenuItem(rejectItem);
          
                          // 創(chuàng)建刪除選項
                          SwipeMenuItem argeeItem = new SwipeMenuItem(getApplicationContext());
                          argeeItem.setBackground(new ColorDrawable(getResources().getColor(R.color.del)));
                          argeeItem.setWidth(dp2px(80, getApplicationContext()));
                          argeeItem.setTitle("刪除");
                          argeeItem.setTitleSize(16);
                          argeeItem.setTitleColor(Color.WHITE);
                          menu.addMenuItem(argeeItem);
                      }
                  };
                  rsmLv.setMenuCreator(creator);

          左滑菜單監(jiān)聽

          rsmLv.setOnMenuItemClickListener(new RefreshSwipeMenuListView.OnMenuItemClickListener() {
                      @Override
                      public void onMenuItemClick(int position, SwipeMenu menu, int index) {
                          switch (index) {
                              case 0: //第一個選項
                                  Toast.makeText(MainActivity.this,"您點擊的是置頂",Toast.LENGTH_SHORT).show();
                                  break;
                              case 1: //第二個選項
                                  del(position,rsmLv.getChildAt(position+1-rsmLv.getFirstVisiblePosition()));
                                  break;
          
                          }
                      }
                  });
          瀏覽 13
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          編輯 分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  日皮太爽了我要看视频 | 成人网站在线观看18 | 国产性爱精品 | 国产三级在线免费 | 国产精品欧美自拍 |