提交 0ddff69c 编写于 作者: xuexiangjys's avatar xuexiangjys 😊

优化演示demo

上级 d97794e4
......@@ -84,6 +84,7 @@ git clone https://github.com/xuexiangjys/TemplateAppProject.git
姓名 | 金额 | 方式
:-|:-|:-
myie9 | 100¥ | 微信
*鸥 | 10.24¥ | 微信
## 联系方式
......
......@@ -95,6 +95,7 @@ dependencies {
//分包
implementation deps.androidx.multidex
implementation 'com.alibaba.android:vlayout:1.2.8'
//下拉刷新
implementation 'com.github.xuexiangjys.SmartRefreshLayout:refresh-header:1.1.5'
implementation 'com.github.xuexiangjys.SmartRefreshLayout:refresh-layout:1.1.5'
......
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.xuexiang.templateproject.adapter;
import android.view.View;
import androidx.annotation.NonNull;
import com.xuexiang.templateproject.R;
import com.xuexiang.templateproject.adapter.entity.NewInfo;
import com.xuexiang.templateproject.utils.XToastUtils;
import com.xuexiang.xui.adapter.recyclerview.BaseRecyclerAdapter;
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
import com.xuexiang.xui.adapter.recyclerview.XRecyclerAdapter;
import com.xuexiang.xui.widget.banner.widget.banner.BannerItem;
import com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner;
import com.xuexiang.xui.widget.banner.widget.banner.base.BaseBanner;
import java.util.ArrayList;
import java.util.List;
/**
* 首页动态新闻【只是用于演示效果】
*
* @author XUE
* @since 2019/5/9 10:41
*/
public class NewsCardViewListAdapter extends BaseRecyclerAdapter<NewInfo> {
private static final int TYPE_BANNER_HEAD = 0;
private static final int TYPE_COMMON = 1;
private List<BannerItem> mData;
/**
* @param bannerData 轮播条的内容
*/
public NewsCardViewListAdapter(List<BannerItem> bannerData) {
super();
mData = bannerData;
}
/**
* 适配的布局
*
* @param viewType
* @return
*/
@Override
protected int getItemLayoutId(int viewType) {
if (viewType == TYPE_BANNER_HEAD) {
return R.layout.include_head_view_banner;
} else {
return R.layout.adapter_news_card_view_list_item;
}
}
@Override
public int getItemViewType(int position) {
if (position == 0) {
return TYPE_BANNER_HEAD;
} else {
return TYPE_COMMON;
}
}
public XRecyclerAdapter refresh(List<NewInfo> data) {
List<NewInfo> list = new ArrayList<>(data);
//用于占位
list.add(0, new NewInfo());
return super.refresh(list);
}
@Override
public void bindData(@NonNull RecyclerViewHolder holder, int position, NewInfo model) {
if (model == null) {
return;
}
if (getItemViewType(position) == TYPE_BANNER_HEAD) {
SimpleImageBanner headBanner = holder.findViewById(R.id.sib_simple_usage);
headBanner.setSource(mData)
.setOnItemClickListener(new BaseBanner.OnItemClickListener<BannerItem>() {
@Override
public void onItemClick(View view, BannerItem item, int position) {
XToastUtils.toast("点击轮播条--->" + position);
}
}).startScroll();
} else {
holder.text(R.id.tv_user_name, model.getUserName());
holder.text(R.id.tv_tag, model.getTag());
holder.text(R.id.tv_title, model.getTitle());
holder.text(R.id.tv_summary, model.getSummary());
holder.text(R.id.tv_praise, model.getPraise() == 0 ? "点赞" : String.valueOf(model.getPraise()));
holder.text(R.id.tv_comment, model.getComment() == 0 ? "评论" : String.valueOf(model.getComment()));
holder.text(R.id.tv_read, "阅读量 " + model.getRead());
holder.image(R.id.iv_image, model.getImageUrl());
}
}
}
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.xuexiang.templateproject.adapter.base.delegate;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
import java.util.Collection;
/**
* 通用的DelegateAdapter适配器
*
* @author xuexiang
* @since 2020/3/20 12:44 AM
*/
public abstract class BaseDelegateAdapter<T> extends XDelegateAdapter<T, RecyclerViewHolder> {
public BaseDelegateAdapter() {
super();
}
public BaseDelegateAdapter(Collection<T> list) {
super(list);
}
public BaseDelegateAdapter(T[] data) {
super(data);
}
/**
* 适配的布局
*
* @param viewType
* @return
*/
protected abstract int getItemLayoutId(int viewType);
@NonNull
@Override
protected RecyclerViewHolder getViewHolder(@NonNull ViewGroup parent, int viewType) {
return new RecyclerViewHolder(inflateView(parent, getItemLayoutId(viewType)));
}
}
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.xuexiang.templateproject.adapter.base.delegate;
import com.alibaba.android.vlayout.LayoutHelper;
import java.util.Collection;
/**
* 简易DelegateAdapter适配器
*
* @author xuexiang
* @since 2020/3/20 12:55 AM
*/
public abstract class SimpleDelegateAdapter<T> extends BaseDelegateAdapter<T> {
private int mLayoutId;
private LayoutHelper mLayoutHelper;
public SimpleDelegateAdapter(int layoutId, LayoutHelper layoutHelper) {
super();
mLayoutId = layoutId;
mLayoutHelper = layoutHelper;
}
public SimpleDelegateAdapter(int layoutId, LayoutHelper layoutHelper, Collection<T> list) {
super(list);
mLayoutId = layoutId;
mLayoutHelper = layoutHelper;
}
public SimpleDelegateAdapter(int layoutId, LayoutHelper layoutHelper, T[] data) {
super(data);
mLayoutId = layoutId;
mLayoutHelper = layoutHelper;
}
@Override
protected int getItemLayoutId(int viewType) {
return mLayoutId;
}
@Override
public LayoutHelper onCreateLayoutHelper() {
return mLayoutHelper;
}
}
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.xuexiang.templateproject.adapter.base.delegate;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.LayoutHelper;
import com.alibaba.android.vlayout.layout.SingleLayoutHelper;
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
/**
* 单独布局的DelegateAdapter
*
* @author xuexiang
* @since 2020/3/20 1:04 AM
*/
public abstract class SingleDelegateAdapter extends DelegateAdapter.Adapter<RecyclerViewHolder> {
private int mLayoutId;
public SingleDelegateAdapter(int layoutId) {
mLayoutId = layoutId;
}
@Override
public LayoutHelper onCreateLayoutHelper() {
return new SingleLayoutHelper();
}
/**
* 加载布局获取控件
*
* @param parent 父布局
* @param layoutId 布局ID
* @return
*/
protected View inflateView(ViewGroup parent, @LayoutRes int layoutId) {
return LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
}
@NonNull
@Override
public RecyclerViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new RecyclerViewHolder(inflateView(parent, mLayoutId));
}
@Override
public int getItemCount() {
return 1;
}
}
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.xuexiang.templateproject.adapter.base.delegate;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.LayoutRes;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.vlayout.DelegateAdapter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
/**
* 基础DelegateAdapter
*
* @author xuexiang
* @since 2020/3/20 12:17 AM
*/
public abstract class XDelegateAdapter<T, V extends RecyclerView.ViewHolder> extends DelegateAdapter.Adapter<V> {
/**
* 数据源
*/
protected final List<T> mData = new ArrayList<>();
/**
* 当前点击的条目
*/
protected int mSelectPosition = -1;
public XDelegateAdapter() {
}
public XDelegateAdapter(Collection<T> list) {
if (list != null) {
mData.addAll(list);
}
}
public XDelegateAdapter(T[] data) {
if (data != null && data.length > 0) {
mData.addAll(Arrays.asList(data));
}
}
/**
* 构建自定义的ViewHolder
*
* @param parent
* @param viewType
* @return
*/
@NonNull
protected abstract V getViewHolder(@NonNull ViewGroup parent, int viewType);
/**
* 绑定数据
*
* @param holder
* @param position 索引
* @param item 列表项
*/
protected abstract void bindData(@NonNull V holder, int position, T item);
/**
* 加载布局获取控件
*
* @param parent 父布局
* @param layoutId 布局ID
* @return
*/
protected View inflateView(ViewGroup parent, @LayoutRes int layoutId) {
return LayoutInflater.from(parent.getContext()).inflate(layoutId, parent, false);
}
@NonNull
@Override
public V onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return getViewHolder(parent, viewType);
}
@Override
public void onBindViewHolder(@NonNull V holder, int position) {
bindData(holder, position, mData.get(position));
}
/**
* 获取列表项
*
* @param position
* @return
*/
public T getItem(int position) {
return checkPosition(position) ? mData.get(position) : null;
}
private boolean checkPosition(int position) {
return position >= 0 && position <= mData.size() - 1;
}
public boolean isEmpty() {
return getItemCount() == 0;
}
@Override
public int getItemCount() {
return mData.size();
}
/**
* @return 数据源
*/
public List<T> getData() {
return mData;
}
/**
* 给指定位置添加一项
*
* @param pos
* @param item
* @return
*/
public XDelegateAdapter add(int pos, T item) {
mData.add(pos, item);
notifyItemInserted(pos);
return this;
}
/**
* 在列表末端增加一项
*
* @param item
* @return
*/
public XDelegateAdapter add(T item) {
mData.add(item);
notifyItemInserted(mData.size() - 1);
return this;
}
/**
* 删除列表中指定索引的数据
*
* @param pos
* @return
*/
public XDelegateAdapter delete(int pos) {
mData.remove(pos);
notifyItemRemoved(pos);
return this;
}
/**
* 刷新列表中指定位置的数据
*
* @param pos
* @param item
* @return
*/
public XDelegateAdapter refresh(int pos, T item) {
mData.set(pos, item);
notifyItemChanged(pos);
return this;
}
/**
* 刷新列表数据
*
* @param collection
* @return
*/
public XDelegateAdapter refresh(Collection<T> collection) {
if (collection != null) {
mData.clear();
mData.addAll(collection);
mSelectPosition = -1;
notifyDataSetChanged();
}
return this;
}
/**
* 刷新列表数据
*
* @param array
* @return
*/
public XDelegateAdapter refresh(T[] array) {
if (array != null && array.length > 0) {
mData.clear();
mData.addAll(Arrays.asList(array));
mSelectPosition = -1;
notifyDataSetChanged();
}
return this;
}
/**
* 加载更多
*
* @param collection
* @return
*/
public XDelegateAdapter loadMore(Collection<T> collection) {
if (collection != null) {
mData.addAll(collection);
notifyDataSetChanged();
}
return this;
}
/**
* 加载更多
*
* @param array
* @return
*/
public XDelegateAdapter loadMore(T[] array) {
if (array != null && array.length > 0) {
mData.addAll(Arrays.asList(array));
notifyDataSetChanged();
}
return this;
}
/**
* 添加一个
*
* @param item
* @return
*/
public XDelegateAdapter load(T item) {
if (item != null) {
mData.add(item);
notifyDataSetChanged();
}
return this;
}
/**
* @return 当前列表的选中项
*/
public int getSelectPosition() {
return mSelectPosition;
}
/**
* 设置当前列表的选中项
*
* @param selectPosition
* @return
*/
public XDelegateAdapter setSelectPosition(int selectPosition) {
mSelectPosition = selectPosition;
notifyDataSetChanged();
return this;
}
/**
* 获取当前列表选中项
*
* @return 当前列表选中项
*/
public T getSelectItem() {
return getItem(mSelectPosition);
}
/**
* 清除数据
*/
public void clear() {
if (!isEmpty()) {
mData.clear();
mSelectPosition = -1;
notifyDataSetChanged();
}
}
}
......@@ -17,18 +17,30 @@
package com.xuexiang.templateproject.fragment.news;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.VirtualLayoutManager;
import com.alibaba.android.vlayout.layout.GridLayoutHelper;
import com.alibaba.android.vlayout.layout.LinearLayoutHelper;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.xuexiang.templateproject.R;
import com.xuexiang.templateproject.adapter.NewsCardViewListAdapter;
import com.xuexiang.templateproject.adapter.base.delegate.SimpleDelegateAdapter;
import com.xuexiang.templateproject.adapter.base.delegate.SingleDelegateAdapter;
import com.xuexiang.templateproject.adapter.entity.NewInfo;
import com.xuexiang.templateproject.core.BaseFragment;
import com.xuexiang.templateproject.utils.DemoDataProvider;
import com.xuexiang.templateproject.utils.Utils;
import com.xuexiang.templateproject.utils.XToastUtils;
import com.xuexiang.xpage.annotation.Page;
import com.xuexiang.xpage.enums.CoreAnim;
import com.xuexiang.xui.utils.WidgetUtils;
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
import com.xuexiang.xui.adapter.simple.AdapterItem;
import com.xuexiang.xui.widget.actionbar.TitleBar;
import com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner;
import com.xuexiang.xui.widget.imageview.ImageLoader;
import com.xuexiang.xui.widget.imageview.RadiusImageView;
import butterknife.BindView;
......@@ -46,7 +58,7 @@ public class NewsFragment extends BaseFragment {
@BindView(R.id.refreshLayout)
SmartRefreshLayout refreshLayout;
private NewsCardViewListAdapter mAdapter;
private SimpleDelegateAdapter<NewInfo> mNewsAdapter;
/**
* @return 返回为 null意为不需要导航栏
......@@ -71,8 +83,78 @@ public class NewsFragment extends BaseFragment {
*/
@Override
protected void initViews() {
WidgetUtils.initRecyclerView(recyclerView, 0);
recyclerView.setAdapter(mAdapter = new NewsCardViewListAdapter(DemoDataProvider.getBannerList()));
VirtualLayoutManager virtualLayoutManager = new VirtualLayoutManager(getContext());
recyclerView.setLayoutManager(virtualLayoutManager);
RecyclerView.RecycledViewPool viewPool = new RecyclerView.RecycledViewPool();
recyclerView.setRecycledViewPool(viewPool);
viewPool.setMaxRecycledViews(0, 10);
//轮播条
SingleDelegateAdapter bannerAdapter = new SingleDelegateAdapter(R.layout.include_head_view_banner) {
@Override
public void onBindViewHolder(@NonNull RecyclerViewHolder holder, int position) {
SimpleImageBanner banner = holder.findViewById(R.id.sib_simple_usage);
banner.setSource(DemoDataProvider.getBannerList())
.setOnItemClickListener((view, item, position1) -> XToastUtils.toast("headBanner position--->" + position1)).startScroll();
}
};
//九宫格菜单
GridLayoutHelper gridLayoutHelper = new GridLayoutHelper(4);
gridLayoutHelper.setPadding(0, 16, 0, 0);
gridLayoutHelper.setVGap(10);
gridLayoutHelper.setHGap(0);
SimpleDelegateAdapter<AdapterItem> commonAdapter = new SimpleDelegateAdapter<AdapterItem>(R.layout.adapter_common_grid_item, gridLayoutHelper, DemoDataProvider.getGridItems(getContext())) {
@Override
protected void bindData(@NonNull RecyclerViewHolder holder, int position, AdapterItem item) {
if (item != null) {
RadiusImageView imageView = holder.findViewById(R.id.riv_item);
imageView.setCircle(true);
ImageLoader.get().loadImage(imageView, item.getIcon());
holder.text(R.id.tv_title, item.getTitle().toString().substring(0, 1));
holder.text(R.id.tv_sub_title, item.getTitle());
holder.click(R.id.ll_container, v -> XToastUtils.toast("点击了:" + item.getTitle()));
}
}
};
//资讯的标题
SingleDelegateAdapter titleAdapter = new SingleDelegateAdapter(R.layout.adapter_title_item) {
@Override
public void onBindViewHolder(@NonNull RecyclerViewHolder holder, int position) {
holder.text(R.id.tv_title, "资讯");
holder.text(R.id.tv_action, "更多");
holder.click(R.id.tv_action, v -> XToastUtils.toast("更多"));
}
};
//资讯
mNewsAdapter = new SimpleDelegateAdapter<NewInfo>(R.layout.adapter_news_card_view_list_item, new LinearLayoutHelper()) {
@Override
protected void bindData(@NonNull RecyclerViewHolder holder, int position, NewInfo model) {
if (model != null) {
holder.text(R.id.tv_user_name, model.getUserName());
holder.text(R.id.tv_tag, model.getTag());
holder.text(R.id.tv_title, model.getTitle());
holder.text(R.id.tv_summary, model.getSummary());
holder.text(R.id.tv_praise, model.getPraise() == 0 ? "点赞" : String.valueOf(model.getPraise()));
holder.text(R.id.tv_comment, model.getComment() == 0 ? "评论" : String.valueOf(model.getComment()));
holder.text(R.id.tv_read, "阅读量 " + model.getRead());
holder.image(R.id.iv_image, model.getImageUrl());
holder.click(R.id.card_view, v -> Utils.goWeb(getContext(), model.getDetailUrl()));
}
}
};
DelegateAdapter delegateAdapter = new DelegateAdapter(virtualLayoutManager);
delegateAdapter.addAdapter(bannerAdapter);
delegateAdapter.addAdapter(commonAdapter);
delegateAdapter.addAdapter(titleAdapter);
delegateAdapter.addAdapter(mNewsAdapter);
recyclerView.setAdapter(delegateAdapter);
}
@Override
......@@ -81,7 +163,7 @@ public class NewsFragment extends BaseFragment {
refreshLayout.setOnRefreshListener(refreshLayout -> {
// TODO: 2020-02-25 这里只是模拟了网络请求
refreshLayout.getLayout().postDelayed(() -> {
mAdapter.refresh(DemoDataProvider.getDemoNewInfos());
mNewsAdapter.refresh(DemoDataProvider.getDemoNewInfos());
refreshLayout.finishRefresh();
}, 1000);
});
......@@ -89,12 +171,10 @@ public class NewsFragment extends BaseFragment {
refreshLayout.setOnLoadMoreListener(refreshLayout -> {
// TODO: 2020-02-25 这里只是模拟了网络请求
refreshLayout.getLayout().postDelayed(() -> {
mAdapter.loadMore(DemoDataProvider.getDemoNewInfos());
mNewsAdapter.loadMore(DemoDataProvider.getDemoNewInfos());
refreshLayout.finishLoadMore();
}, 1000);
});
refreshLayout.autoRefresh();//第一次进入触发自动刷新,演示效果
mAdapter.setOnItemClickListener((itemView, item, position) -> Utils.goWeb(getContext(), item.getDetailUrl()));
}
}
......@@ -17,8 +17,14 @@
package com.xuexiang.templateproject.utils;
import android.content.Context;
import android.graphics.drawable.Drawable;
import com.xuexiang.templateproject.R;
import com.xuexiang.templateproject.adapter.entity.NewInfo;
import com.xuexiang.xaop.annotation.MemoryCache;
import com.xuexiang.xui.adapter.simple.AdapterItem;
import com.xuexiang.xui.utils.ResUtils;
import com.xuexiang.xui.widget.banner.widget.banner.BannerItem;
import java.util.ArrayList;
......@@ -96,5 +102,19 @@ public class DemoDataProvider {
return list;
}
public static List<AdapterItem> getGridItems(Context context) {
return getGridItems(context, R.array.grid_titles_entry, R.array.grid_icons_entry);
}
private static List<AdapterItem> getGridItems(Context context, int titleArrayId, int iconArrayId) {
List<AdapterItem> list = new ArrayList<>();
String[] titles = ResUtils.getStringArray(titleArrayId);
Drawable[] icons = ResUtils.getDrawableArray(context, iconArrayId);
for (int i = 0; i < titles.length; i++) {
list.add(new AdapterItem(titles[i], icons[i]));
}
return list;
}
}
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<com.xuexiang.xui.widget.alpha.XUIAlphaLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/ll_container"
android:layout_width="match_parent"
android:layout_height="80dp"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.xuexiang.xui.widget.imageview.RadiusImageView
android:id="@+id/riv_item"
android:layout_width="50dp"
android:layout_height="50dp"
tools:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tv_title"
style="@style/TextStyle.Title"
android:layout_gravity="center"
android:textColor="@color/xui_config_color_white"
tools:text="菜" />
</FrameLayout>
<TextView
android:id="@+id/tv_sub_title"
style="@style/TextStyle.Explain"
android:layout_marginTop="5dp"
tools:text="菜单1" />
</com.xuexiang.xui.widget.alpha.XUIAlphaLinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp">
<TextView
android:id="@+id/tv_title"
style="@style/TextStyle.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
tools:text="标题" />
<TextView
android:id="@+id/tv_action"
style="@style/TextStyle.Explain"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp"
tools:text="更多" />
</FrameLayout>
......@@ -20,6 +20,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/xui_config_color_white"
android:orientation="vertical">
<com.scwang.smartrefresh.layout.SmartRefreshLayout
......
......@@ -57,5 +57,27 @@
<item>bayimob.com</item>
</string-array>
<string-array name="grid_titles_entry">
<item>美食</item>
<item>甜点</item>
<item>烧烤</item>
<item>夜宵</item>
<item>水果</item>
<item>药品</item>
<item>蔬菜</item>
<item>跑腿</item>
</string-array>
<!-- 修改这里的图标 -->
<array name="grid_icons_entry">
<item>@color/app_color_theme_1</item>
<item>@color/app_color_theme_2</item>
<item>@color/app_color_theme_3</item>
<item>@color/app_color_theme_4</item>
<item>@color/app_color_theme_5</item>
<item>@color/app_color_theme_6</item>
<item>@color/app_color_theme_7</item>
<item>@color/app_color_theme_8</item>
</array>
</resources>
\ No newline at end of file
......@@ -13,4 +13,15 @@
<color name="toast_warning_color" tools:ignore="PrivateResource">@color/xui_config_color_waring</color>
<color name="toast_normal_tint_color" tools:ignore="PrivateResource">#353A3E</color>
<color name="app_color_theme_1">#EF5362</color> <!-- Grapefruit -->
<color name="app_color_theme_2">#FE6D4B</color> <!-- Bittersweet -->
<color name="app_color_theme_3">#FFCF47</color> <!-- Sunflower -->
<color name="app_color_theme_4">#9FD661</color> <!-- Grass -->
<color name="app_color_theme_5">#3FD0AD</color> <!-- Mint -->
<color name="app_color_theme_6">#2BBDF3</color> <!-- Aqua -->
<color name="app_color_theme_7">#5A9AEF</color> <!-- Blue Jeans -->
<color name="app_color_theme_8">#AC8FEF</color> <!-- Lavender -->
<color name="app_color_theme_9">#EE85C1</color> <!-- Pink Rose -->
</resources>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册