欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android仿拉手网团购App我的收藏界面实例代码

程序员文章站 2023-12-09 20:03:45
先给大家展示效果图,如果感觉还不错,请参考实例代码 效果图如下所示: 具体代码如下: private void initdata() { bmobma...

先给大家展示效果图,如果感觉还不错,请参考实例代码

效果图如下所示:

Android仿拉手网团购App我的收藏界面实例代码

具体代码如下:

private void initdata() {
 bmobmanager.getinstance(new bmobquerycallback() {
  @override
  public void onquerysuccess(list<? extends basemodel> datalist) {
   mdatalist.clear();
   list<favormodel> list = (list<favormodel>) datalist;
   if (list == null || list.size()==0) {
    mlistview.setvisibility(view.gone);
    merrorlayout.setvisibility(view.visible);
   } else {
    mdatalist.addall(list);
    madapter.notifydatasetchanged();
    mlistview.setvisibility(view.visible);
    merrorlayout.setvisibility(view.gone);
   }
  }
  @override
  public void onqueryfailure(bmobexception e) {
   mlistview.setvisibility(view.gone);
   merrorlayout.setvisibility(view.visible);
  }
 }).queryfavordata(appconstant.key_user_id, user.getcurrentuser().getobjectid());
}

activity_collect.xml

<?xml version="1.0" encoding="utf-8"?>
<linearlayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical"
 android:background="@color/bg_common_gray"
 tools:context="com.myxh.coolshopping.ui.activity.collectactivity">
 <relativelayout
  android:layout_width="match_parent"
  android:layout_height="@dimen/common_titlebar_height"
  android:background="@color/title_bar_color">
  <imageview
   android:id="@+id/collect_titlebar_iv_back"
   style="@style/common_left_back_imageview_style"/>
  <textview
   style="@style/base_textview_style"
   android:layout_centerinparent="true"
   android:gravity="center_vertical"
   android:text="@string/my_collection"
   android:textsize="@dimen/login_titlebar_login_size"
   android:textcolor="@color/textcolor_32"/>
  <textview
   android:id="@+id/collect_titlebar_tv_manager"
   style="@style/common_right_title_textview_style"
   android:gravity="center"
   android:text="@string/collect_titlebar_manager"
   android:textcolor="@color/orange"
   android:textsize="@dimen/login_titlebar_register_size"/>
 </relativelayout>
 <view
  style="@style/me_horizontal_view_style"/>
 <listview
  android:id="@+id/collect_listview"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:visibility="gone"/>
 <linearlayout
  android:id="@+id/collect_error_layout"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:gravity="center">
  <textview
   android:id="@+id/collect_error_tv"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:gravity="center"
   android:drawabletop="@mipmap/net_failed"
   android:drawablepadding="10dp"
   android:text="@string/collect_have_no_collection"
   android:textcolor="@color/gray01"
   android:textsize="@dimen/textsize_16"
   android:visibility="visible"/>
 </linearlayout>
</linearlayout>

以上所述是小编给大家介绍的android仿拉手团购app我的收藏界面实例代码,希望对大家有所帮助