編輯:關於android開發

govaffair_pager.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:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#802f4f4f"
android:gravity="center_vertical">
<CheckBox
android:id="@+id/checkbox_all"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:button="@drawable/selector_checkbox"
android:checked="true"
android:text="全選"
android:textColor="#88ffffff" />
<TextView
android:id="@+id/tv_total_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/checkbox_all"
android:text="合計 ¥40 "
android:textColor="#88ffffff"
android:textSize="28sp" />
<Button
android:id="@+id/btn_order"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/btn_bg_selector"
android:padding="8dp"
android:text="去結算"
android:textColor="@android:color/white" />
<Button
android:id="@+id/btn_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/btn_bg_selector"
android:padding="10dp"
android:text="刪除"
android:textColor="@android:color/white"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
public class GovaffairPagerAdapter extends RecyclerView.Adapter<GovaffairPagerAdapter.ViewHolder> {
private final Context context;
private final List<ShopingCart> datas;
public GovaffairPagerAdapter(Context context, List<ShopingCart> datas) {
this.context = context;
this.datas = datas;
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = View.inflate(context, R.layout.item_govaffairpager, null);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
ShoppingCart wares = datas.get(position);
//加載圖片
Glide.with(context).load(wares.getImgUrl()).
placeholder(R.drawable.news_pic_default).
error(R.drawable.news_pic_default)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.into(holder.iv_icon);
holder.checkbox.setChecked(cart.isChecked());
holder.tv_name.setText(wares.getName());
holder.tv_price.setText("¥ "+wares.getPrice());
holder.numberAddSubView.setValue(wares.getCount());
}
@Override
public int getItemCount() {
return datas.size();
}
class ViewHolder extends RecyclerView.ViewHolder {
private CheckBox checkbox;
private ImageView iv_icon;
private TextView tv_name;
private TextView tv_price;
private NumberAddSubView numberAddSubView;
public ViewHolder(View itemView) {
super(itemView);
checkbox = (CheckBox) itemView.findViewById(R.id.checkbox);
iv_icon = (ImageView) itemView.findViewById(R.id.iv_icon);
tv_name = (TextView) itemView.findViewById(R.id.tv_name);
tv_price = (TextView) itemView.findViewById(R.id.tv_price);
numberAddSubView = (NumberAddSubView) itemView.findViewById(R.id.numberAddSubView);
}
}
}
JSON解析和XML解析對比,JSON解析XML解析
JSON解析和XML解析對比,JSON解析XML解析 JSON解析和XML解析是較為普遍的兩種解析方式,其中JSON解析的市場分額更大
第三方開源框架的下拉刷新列表(QQ比較常用的)。,開源框架
第三方開源框架的下拉刷新列表(QQ比較常用的)。,開源框架PullToRefreshListView是第三方開源框架下拉刷新列表,比較流行的QQ 微信等上面都在用。 下載
android permission權限與安全機制解析(下)
android permission權限與安全機制解析(下) android 6.0權限全面詳細分析和解決方案 Marshmallow版本權限修改 androi
安卓第一天筆記,安卓第一天
安卓第一天筆記,安卓第一天安卓第一天筆記 1.移動通信的發展G--(generation) 1G:模擬制式 2G:GSM/CDMA 2.5G:GPRS 2.75G:EDG
Android應用項目中BaseAdapter、SimpleAdapter和ArrayAdapter中的三種適配器,simplearrayadapter
Android應用項目中BaseAdapter、SimpleAdapte