Android實(shí)現(xiàn)購物車功能
最近看了一些淘寶購物車的demo,于是也寫了一個。
效果圖如下:

主要代碼如下:
actvity中的代碼:
public class ShoppingCartActivity extends BaseActivity {
private List<Test> data;
private ListView mListView;
private ShoppingCartAdapter adapter;
private RelativeLayout rlRefresh;
private TextView tvRefresh;
private ProgressBar barRefresh;
private LinearLayout clear;
private CheckBox checkBox_select_all;
private CheckBox checkBox_add;
private TextView integral_sum;
private int sum = 0;
private int[] sumIntegral;
private Context context;
@Override
protected void onCreate(Bundle bundle) {
// TODO Auto-generated method stub
super.onCreate(bundle);
setContentView(R.layout.activity_shopping_cart);
initView();
}
private void initView() {
context = this;
showpage = 1;
isPermitFlag = true;
data = new ArrayList<Test>();
// 測試數(shù)據(jù)
data.add(new Test("id", "color", "type", "100"));
data.add(new Test("id", "color", "type", "200"));
data.add(new Test("id", "color", "type", "300"));
data.add(new Test("id", "color", "type", "0"));
data.add(new Test("id", "color", "type", "300"));
data.add(new Test("id", "color", "type", "100"));
data.add(new Test("id", "color", "type", "500"));
data.add(new Test("id", "color", "type", "0"));
data.add(new Test("id", "color", "type", "900"));
adapter = new ShoppingCartAdapter(context, handler, data);
sumIntegral = new int[data.size() + 1];
checkBox_add = (CheckBox) findViewById(R.id.checkbox_add);
integral_sum = (TextView) findViewById(R.id.integral_sum);
clear = (LinearLayout) findViewById(R.id.clear);
clear.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
data.clear();
adapter.notifyDataSetChanged();
integral_sum.setText(0 + "");
checkBox_select_all.setChecked(false);
checkBox_add.setClickable(false);
}
});
checkBox_select_all = (CheckBox) findViewById(R.id.checkbox_select);
checkBox_select_all.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
HashMap<Integer, Boolean> isSelected = ShoppingCartAdapter
.getIsSelected();
Iterator iterator = isSelected.entrySet().iterator();
List<Boolean> array = new ArrayList<Boolean>();//列表中checkbox選中狀態(tài)
List<Integer> nums = new ArrayList<Integer>();//列表中商品數(shù)量
while (iterator.hasNext()) {
HashMap.Entry entry = (HashMap.Entry) iterator.next();
Integer key = (Integer) entry.getKey();
Boolean val = (Boolean) entry.getValue();
array.add(val);
}
for (int i = 0; i < data.size(); i++) {
int num = data.get(i).getNum();
int integral = Integer.valueOf(data.get(i).getIntegral());
nums.add(num);
}
if (checkBox_select_all.isChecked()) {
for (int i = 0; i < data.size(); i++) {
ShoppingCartAdapter.getIsSelected().put(i, true);
}
checkBox_add.setChecked(true);
adapter.notifyDataSetChanged();
} else {
for (int i = 0; i < data.size(); i++) {
ShoppingCartAdapter.getIsSelected().put(i, false);
}
checkBox_add.setChecked(false);
adapter.notifyDataSetChanged();
integral_sum.setText(0 + "");
}
}
});
mListView= (ListView) findViewById(R.id.finance_list);
mListView.setAdapter(adapter);
mListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Toast.makeText(context, position + "", Toast.LENGTH_LONG)
.show();
int pos = position - 1;
ViewHolder viewHolder = (ViewHolder) view.getTag();
int num = data.get(pos).getNum();
if (num == 0) {
Toast.makeText(context, "請選擇商品數(shù)量", Toast.LENGTH_LONG)
.show();
} else {
boolean cu = !ShoppingCartAdapter.getIsSelected().get(pos);
ShoppingCartAdapter.getIsSelected().put(pos, cu);
adapter.notifyDataSetChanged();
//遍歷獲取列表中checkbox的選中狀態(tài)
HashMap<Integer, Boolean> isSelected = ShoppingCartAdapter
.getIsSelected();
Iterator iterator = isSelected.entrySet().iterator();
List<Boolean> array = new ArrayList<Boolean>();
while (iterator.hasNext()) {
HashMap.Entry entry = (HashMap.Entry) iterator.next();
Integer key = (Integer) entry.getKey();
Boolean val = (Boolean) entry.getValue();
array.add(val);
}
if (Test.isAllFalse(array)) {
checkBox_select_all.setChecked(false);
checkBox_add.setChecked(false);
}
if (Test.isAllTrue(array)) {
checkBox_select_all.setChecked(true);
checkBox_add.setChecked(true);
}
if (Test.isHaveOneFasle(array)) {
checkBox_select_all.setChecked(false);
}
if (Test.isHaveOneTrue(array)) {
checkBox_add.setChecked(true);
}
}
}
});
}
@SuppressLint("HandlerLeak")
private Handler handler = new Handler(){
@SuppressWarnings("unchecked")
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if(msg.what == 10){ //更改選中商品的總價格
float price = (Float)msg.obj;
if(price > 0){
integral_sum.setText(price+"");
}else{
integral_sum.setText("0");
}
}
else if(msg.what == 11){
//列表選中狀態(tài)
List<Boolean> array = (List<Boolean>) msg.obj;
if (Test.isAllFalse(array)) {
checkBox_select_all.setChecked(false);
checkBox_add.setChecked(false);
}
if (.isAllTrue(array)) {
checkBox_select_all.setChecked(true);
checkBox_add.setChecked(true);
}
if (Test.isHaveOneFasle(array)) {
checkBox_select_all.setChecked(false);
}
if (Test.isHaveOneTrue(array)) {
checkBox_add.setChecked(true);
}
}
}
};
actvity中XML的代碼:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:header=http://schemas.android.com/apk/res/com.sxc.test"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/app_background"
android:orientation="vertical" >
<com.autoserve.core.widget.HeaderWidget
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
header:text="我的購物車" />
<LinearLayout
android:id="@+id/layout1"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="@id/header"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:background="@color/white"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkbox_select"
style="@style/CustomCheckboxTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="全選"
android:textColor="@color/gry_666666"
android:textSize="@dimen/small_size" />
</LinearLayout>
<LinearLayout
android:id="@+id/clear"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="20dp"
android:gravity="center_vertical|right"
android:orientation="horizontal" >
<CheckBox
android:layout_width="12dp"
android:layout_height="12dp"
android:background="@drawable/clear" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="清空購物車"
android:textColor="#b61d1d"
android:textSize="@dimen/small_size" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/layout1"
android:layout_marginBottom="50dp"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="@color/divider_color" />
<ListView
android:id="@+id/finance_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:divider="@color/lucency" />
<include
layout="@layout/include_refresh"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="@color/gry_999999"
android:gravity="center_vertical"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:gravity="center"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkbox_add"
style="@style/CustomCheckboxTheme2"
android:layout_width="wrap_content"
android:clickable="false"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="合計:"
android:textColor="@color/white"
android:textSize="@dimen/small_size" />
<TextView
android:id="@+id/integral_sum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:text="0"
android:textColor="@color/theme_color"
android:textSize="@dimen/small_size" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="積分"
android:textColor="@color/white"
android:textSize="@dimen/small_size" />
</LinearLayout>
</LinearLayout>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/theme_color"
android:gravity="center"
android:text="結(jié)算"
android:textColor="@color/white"
android:textSize="@dimen/small_size" />
</LinearLayout>
</RelativeLayout>
-XML中頭部可以到網(wǎng)上找一個這里就不放上來了
.checkbox和button的樣式可以根據(jù)個人喜好設(shè)置。
Adaper中的代碼:
public class ShoppingCartAdapter extends BaseAdapter {
private Context context;
private List<Test> loans;
private LayoutInflater inflater;
private static HashMap<Integer, Boolean> isSelected;
private static HashMap<Integer, Integer> numbers;
private Handler handler;
int num;// 商品數(shù)量
static class ViewHolder { // 自定義控件集合
public CheckBox ck_select;
public ImageView pic_goods;
public TextView id_goods;
public TextView color_goods;
public TextView type_goods;
public TextView integral_goods;
public AddMinusWidget add_minus;
public LinearLayout layout;
public TextView number;
public Button minus;
public Button plus;
}
/**
* 實(shí)例化Adapter
*
* @param context
* @param data
*/
public ShoppingCartAdapter(Context context, Handler handler, List<Test> data) {
this.context = context;
this.inflater = LayoutInflater.from(context);
this.loans = data;
this.handler = handler;
isSelected = new HashMap<Integer, Boolean>();
numbers = new HashMap<Integer, Integer>();
initDate();
}
private void initDate() {
for (int i = 0; i < loans.size(); i++) {
getIsSelected().put(i, false);
getNumbers().put(i, 1);
}
}
@Override
public int getCount() {
return loans.size();
}
@Override
public Object getItem(int position) {
return loans.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
// 自定義視圖
ViewHolder itemView = null;
if (convertView == null) {
// 獲取list_item布局文件的視圖
itemView = new ViewHolder();
convertView = inflater.inflate(R.layout.list_shopping_cart_item,
null);
// 獲取控件對象
itemView.ck_select = (CheckBox) convertView
.findViewById(R.id.ck_select);
itemView.pic_goods = (ImageView) convertView
.findViewById(R.id.pic_goods);
itemView.id_goods = (TextView) convertView
.findViewById(R.id.id_goods);
itemView.color_goods = (TextView) convertView
.findViewById(R.id.color_goods);
itemView.type_goods = (TextView) convertView
.findViewById(R.id.type_goods);
itemView.integral_goods = (TextView) convertView
.findViewById(R.id.integral_goods);
itemView.number = (TextView) convertView.findViewById(R.id.number);
itemView.minus = (Button) convertView.findViewById(R.id.minus);
itemView.plus = (Button) convertView.findViewById(R.id.plus);
convertView.setTag(itemView);
} else {
itemView = (ViewHolder) convertView.getTag();
}
init(itemView, position);
itemView.ck_select.setChecked(getIsSelected().get(position));
itemView.number.setText(getNumbers().get(position).toString());
if (getIsSelected().get(position)) {
itemView.ck_select.setChecked(true);
} else {
itemView.ck_select.setChecked(false);
}
String a = itemView.number.getText().toString();
loans.get(position).setNum(Integer.valueOf(a));
Test test = loans.get(position);
itemView.id_goods.setText((CharSequence) test.getId());
itemView.color_goods.setText((CharSequence) test.getColor());
itemView.type_goods.setText((CharSequence) test.getType());
itemView.integral_goods.setText((CharSequence) test.getIntegral());
itemView.pic_goods.setImageResource(R.drawable.shopping);
return convertView;
}
private void init(final ViewHolder itemView, final int position) {
itemView.ck_select
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
isSelected.put(position, true);
getIsSelected().put(position, isChecked);
itemView.ck_select.setChecked(getIsSelected().get(
position));
handler.sendMessage(handler.obtainMessage(10,
getTotalPrice()));
Iterator iterator = isSelected.entrySet().iterator();
List<Boolean> array = new ArrayList<Boolean>();
while (iterator.hasNext()) {
HashMap.Entry entry = (HashMap.Entry) iterator
.next();
Integer key = (Integer) entry.getKey();
Boolean val = (Boolean) entry.getValue();
array.add(val);
}
handler.sendMessage(handler.obtainMessage(11, array));
}
});
final String numString = itemView.number.getText().toString();
itemView.plus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (numString == null || numString.equals("")) {
num = 1;
itemView.number.setText("1");
} else {
if (++num < 1) // 先加,再判斷
{
num--;
Toast.makeText(context, "請輸入一個大于0的數(shù)字",
Toast.LENGTH_SHORT).show();
} else {
itemView.number.setText(String.valueOf(num));
loans.get(position).setNum(num);
numbers.put(position, num);
handler.sendMessage(handler.obtainMessage(10,
getTotalPrice()));
Log.i("test", "+:" + num);
}
}
}
});
itemView.minus.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (numString == null || numString.equals("")) {
num = 1;
itemView.number.setText("1");
} else {
if (--num < 1) // 先加,再判斷
{
num++;
Log.i("test", "-:" + num);
Toast.makeText(context, "請輸入一個大于0的數(shù)字",
Toast.LENGTH_SHORT).show();
Log.i("test", "-:" + num);
} else {
itemView.number.setText(String.valueOf(num));
Log.i("test", "-:" + num);
loans.get(position).setNum(num);
numbers.put(position, num);
handler.sendMessage(handler.obtainMessage(10,
getTotalPrice()));
}
}
}
});
}
/**
* 計算選中商品的積分
*
* @return 返回需要付費(fèi)的總積分
*/
private float getTotalPrice() {
Test bean = null;
float totalPrice = 0;
for (int i = 0; i < loans.size(); i++) {
bean = loans.get(i);
if (ShoppingCartAdapter.getIsSelected().get(i)) {
totalPrice += bean.getNum()
* Integer.valueOf(bean.getIntegral());
}
}
return totalPrice;
}
public static HashMap<Integer, Boolean> getIsSelected() {
return isSelected;
}
public static void setIsSelected(HashMap<Integer, Boolean> isSelected) {
ShoppingCartAdapter.isSelected = isSelected;
}
public static HashMap<Integer, Integer> getNumbers() {
return numbers;
}
public static void setNumbers(HashMap<Integer, Integer> numbers) {
ShoppingCartAdapter.numbers = numbers;
}
}
Adapter中的XML代碼:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:background="@color/white"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="@color/divider_color" />
<LinearLayout
android:id="@+id/layout5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="5dp" >
<CheckBox
android:id="@+id/ck_select"
style="@style/CustomCheckboxTheme"
android:layout_width="wrap_content"
android:focusable="false"
android:layout_height="wrap_content"
android:layout_marginRight="5dp" />
<ImageView
android:id="@+id/pic_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitCenter"
android:src="@drawable/shopping" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical" >
<TextView
android:id="@+id/id_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="短襪男士星期 POLO棉襪潮男秋冬款禮盒裝"
android:textColor="@color/gry_999999"
android:textSize="@dimen/small_size" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="顏色:"
android:textColor="@color/gry_999999"
android:textSize="12sp" />
<TextView
android:id="@+id/color_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="黑色"
android:textColor="@color/gry_999999"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="規(guī)格:"
android:textColor="@color/gry_999999"
android:textSize="12sp" />
<TextView
android:id="@+id/type_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="普通"
android:textColor="@color/gry_999999"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="所需積分"
android:textColor="@color/theme_color"
android:textSize="12sp" />
<TextView
android:id="@+id/integral_goods"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1000"
android:layout_marginLeft="5dp"
android:textColor="@color/theme_color"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="25dp"
android:layout_gravity="bottom"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:gravity="right"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="80dp"
android:layout_height="25dp"
android:layout_gravity="right"
android:background="@color/white"
android:orientation="horizontal" >
<Button
android:id="@+id/minus"
android:layout_width="25dp"
android:layout_height="match_parent"
android:background="@drawable/kuangzi1"
android:gravity="center"
android:focusable="false"
android:text="-"
android:textColor="@color/black" >
</Button>
<TextView
android:id="@+id/number"
android:layout_width="30dp"
android:layout_height="match_parent"
android:background="@drawable/kuangzi1"
android:gravity="center"
android:inputType="number"
android:text="1"
android:textColor="@color/black" >
</TextView>
<Button
android:id="@+id/plus"
android:layout_width="25dp"
android:layout_height="match_parent"
android:background="@drawable/kuangzi1"
android:gravity="center"
android:focusable="false"
android:text="+"
android:textColor="@color/black" >
</Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="0.1dp"
android:background="@color/divider_color" />
</LinearLayout>
實(shí)體類:
package com.autoserve.net33.model;
public class Test {
@Override
public String toString() {
return "test [id=" + id + ", color=" + color
+ ", type=" + type + ", integral=" + integral + "]";
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getIntegral() {
return integral;
}
public void setIntegral(String integral) {
this.integral = integral;
}
private String id;
private String color;
private String type;
private String integral;
private int num;//商品數(shù)量
private int sumIntegral;
private boolean isChoosed; //商品是否在購物車中被選中
public Test(String id, String color, String type, String integral) {
super();
this.id = id;
this.color = color;
this.type = type;
this.integral = integral;
}
public Test() {
super();
}
public int getNum() {
return num;
}
public void setNum(int num) {
this.num = num;
}
public int getSumIntegral() {
return sumIntegral;
}
public void setSumIntegral(int sumIntegral) {
this.sumIntegral = sumIntegral;
}
public boolean isChoosed() {
return isChoosed;
}
public void setChoosed(boolean isChoosed) {
this.isChoosed = isChoosed;
}
}
以上就是本文的全部內(nèi)容,祝大家在新的一年里工作順利,事事順心,我們大家共同努力。
- Android實(shí)現(xiàn)的仿淘寶購物車demo示例
- Android實(shí)現(xiàn)仿淘寶購物車增加和減少商品數(shù)量功能demo示例
- Android Studio實(shí)現(xiàn)簡單購物車功能
- Android實(shí)現(xiàn)簡單購物車功能
- Android把商品添加到購物車的動畫效果(貝塞爾曲線)
- Android實(shí)現(xiàn)商城購物車功能的實(shí)例代碼
- Android中實(shí)現(xiàn)淘寶購物車RecyclerView或LIstView的嵌套選擇的邏輯
- Android仿外賣購物車功能
- Android實(shí)現(xiàn)添加商品到購物車動畫效果
- Android實(shí)現(xiàn)簡單購物車
相關(guān)文章
Android組件創(chuàng)建DrawerLayout導(dǎo)航
這篇文章主要為大家詳細(xì)介紹了Android組件創(chuàng)建DrawerLayout導(dǎo)航的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-01-01
RxJava入門指南及其在Android開發(fā)中的使用示例
RxJava是JVM的一個擴(kuò)展庫,它能夠幫助Java更加方便地實(shí)現(xiàn)基于事件的編程,這對安卓來說十分有用,接下來就一起來看一下RxJava入門指南及其在Android開發(fā)中的使用示例:2016-06-06
Android AlertDialog多種創(chuàng)建方式案例詳解
這篇文章主要介紹了Android AlertDialog多種創(chuàng)建方式案例詳解,本篇文章通過簡要的案例,講解了該項技術(shù)的了解與使用,以下就是詳細(xì)內(nèi)容,需要的朋友可以參考下2021-08-08
Android仿天貓橫向滑動指示器功能的實(shí)現(xiàn)
這篇文章主要介紹了Android仿天貓橫向滑動指示器,Android開發(fā)中會有很多很新奇的交互,比如天貓商城的首頁頭部的分類,使用的是GridLayoutManager+橫向指示器實(shí)現(xiàn)的,需要的朋友可以參考下2022-08-08
Android 解決ScrollView嵌套CridView顯示問題
這篇文章主要介紹了Android 解決ScrollView嵌套CridView顯示問題的相關(guān)資料,使用ScrollView嵌套CridView的時候會出現(xiàn)顯示不全的問題,這里提供解決辦法,需要的朋友可以參考下2017-08-08
Android實(shí)現(xiàn)在一個activity中添加多個listview的方法
這篇文章主要介紹了Android實(shí)現(xiàn)在一個activity中添加多個listview的方法,分析了Activity中添加listview的原理與具體實(shí)現(xiàn)方法,需要的朋友可以參考下2016-08-08
OpenGL ES 矩陣變換及其數(shù)學(xué)原理詳解(五)
這篇文章主要為大家詳細(xì)介紹了OpenGL ES 矩陣變換及其數(shù)學(xué)原理的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-05-05

