`

ViewPager、Fragment、ListView组合使用

阅读更多

OrderCenterActivity.java:

 

package com.weijie.user.activity;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.weijie.user.R;

public class OrderCenterActivity extends BaseFragmentActivity{

	private ViewPager viewPager;
	private final int ALL = 0;
	private final int PRE_PAY = 1;
	private final int PRE_SEND = 2;
	private final int AFTER_SEND = 3;
	private final int PRE_ESTIMATE = 4;
	private TextView allText,prePayText,preSendText,afterSendText,preEstimateText;
	private List<Map<String, Object>> mData1,mData2,mData3,mData4,mData5;
	private TextView refund_aftersales_tv;//退款/售后
	private ImageView cursor;// 动画图片
	private int offset = 0;// 动画图片偏移量
	private int currIndex = 0;// 当前页卡编号
	private int bmpW;// 动画图片宽度
	
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		setContentView(R.layout.order_center);
		//mData = getData();
		initTab();
		InitImageView(); 
		viewPager = (ViewPager) findViewById(R.id.viewPager);
		MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager());
		viewPager.setAdapter(adapter);
		viewPager.setOnPageChangeListener(new MyOnPageChangeListener());  
		viewPager.setCurrentItem(ALL);
	}
	
	private void initTab() {
		allText = (TextView) findViewById(R.id.text1);
		prePayText = (TextView) findViewById(R.id.text2);
		preSendText = (TextView) findViewById(R.id.text3);
		afterSendText = (TextView) findViewById(R.id.text4);
		preEstimateText = (TextView) findViewById(R.id.text5);
		refund_aftersales_tv = (TextView) findViewById(R.id.refund_aftersales_tv);
		
		allText.setOnClickListener(new MyOnClickListener(0));
		prePayText.setOnClickListener(new MyOnClickListener(1));
		preSendText.setOnClickListener(new MyOnClickListener(2));
		afterSendText.setOnClickListener(new MyOnClickListener(3));
		preEstimateText.setOnClickListener(new MyOnClickListener(4));
		refund_aftersales_tv.setOnClickListener(new OnClickRefundListener());
	}
	
	//退款/售后
	public class OnClickRefundListener implements OnClickListener {

		@Override
		public void onClick(View view) {
			Intent intent = new Intent(OrderCenterActivity.this,
					OrderRefundingActivity.class);
			startActivity(intent);
		}
	}
	
	private List<Map<String, Object>> getData() {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("goods_img", R.drawable.goods_img);
		map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花");
		map.put("shop_name", "GXG官方旗舰店");
		map.put("order_number", "2件商品");
		map.put("order_price", "¥98.00");
		list.add(map);

		map = new HashMap<String, Object>();
		map.put("goods_img", R.drawable.goods_img);
		map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花");
		map.put("shop_name", "GXG官方旗舰店");
		map.put("order_number", "3件商品");
		map.put("order_price", "¥98.00");
		list.add(map);

		map = new HashMap<String, Object>();
		map.put("goods_img", R.drawable.goods_img);
		map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花");
		map.put("shop_name", "GXG官方旗舰店");
		map.put("order_number", "4件商品");
		map.put("order_price", "¥98.00");
		list.add(map);

		return list;
	}
	
	private List<Map<String, Object>> getData2() {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("goods_img", R.drawable.goods_img);
		map.put("product_title", "韩版男式衬衫 休闲 圆领 热销中");
		map.put("shop_name", "GXG官方旗舰店");
		map.put("order_number", "2件商品");
		map.put("order_price", "¥98.00");
		list.add(map);

		map = new HashMap<String, Object>();
		map.put("goods_img", R.drawable.goods_img);
		map.put("product_title", "红玫瑰花束鲜花预定合肥鲜花速递生日鲜花");
		map.put("shop_name", "GXG官方旗舰店");
		map.put("order_number", "4件商品");
		map.put("order_price", "¥98.00");
		list.add(map);

		return list;
	}
	
	private List<Map<String, Object>> getData3() {
		List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();

		Map<String, Object> map = new HashMap<String, Object>();
		map.put("goods_img", R.drawable.goods_img);
		map.put("product_title", "阿迪达斯 时尚运动鞋 特价 促销中");
		map.put("shop_name", "GXG官方旗舰店");
		map.put("order_number", "2件商品");
		map.put("order_price", "¥98.00");
		list.add(map);

		return list;
	}
	
	/**
	 * 初始化动画
	 */
	private void InitImageView() {
		cursor = (ImageView) findViewById(R.id.cursor);
		Bitmap bitMap = BitmapFactory.decodeResource(getResources(), R.drawable.tab_red_bottom);
		bmpW = bitMap.getWidth();// 获取图片宽度
		DisplayMetrics dm = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(dm);
		int screenW = dm.widthPixels;// 获取分辨率宽度
		offset = (screenW / 5 - bmpW) / 2;// 计算偏移量
		Matrix matrix = new Matrix();
		matrix.postTranslate(0, 0);
		matrix.postScale(((float) (screenW / 5)) / bmpW, bitMap.getHeight());
		cursor.setImageMatrix(matrix);// 设置动画初始位置
	}
	
	/**
	 * 头标点击监听
	 */
	public class MyOnClickListener implements View.OnClickListener {
		private int index = 0;

		public MyOnClickListener(int i) {
			index = i;
		}
		
		@Override
		public void onClick(View v) {
			viewPager.setCurrentItem(index);  
		}
	}
	
	class MyPagerAdapter extends FragmentPagerAdapter{

		public MyPagerAdapter(FragmentManager fm) {
			super(fm);
		}

		@Override
		public Fragment getItem(int position) {
			Fragment fragment = new OrderCenterFragment();
			Bundle args = new Bundle();
			args.putInt(OrderCenterFragment.ARG_SECTION_NUMBER, position);
			fragment.setArguments(args);
			return fragment;
		}

		@Override
		public int getCount() {
			return 5;
		}
    	
    }
	
	@SuppressLint("ValidFragment")
	class OrderCenterFragment extends Fragment{
		public static final String ARG_SECTION_NUMBER = "section_number";
		
		@Override
		public View onCreateView(LayoutInflater inflater, ViewGroup container,
				Bundle savedInstanceState) {
			int section = getArguments().getInt(ARG_SECTION_NUMBER);
			ListView listView=null;
			OrderCenterAdapter adapter=null;
			//发送请求加载数据列表
			System.out.println("i==="+section);
			if("0".equals(section+"")){
				mData1 = getData();
				listView = (ListView) inflater.inflate(R.layout.fragment_order_center, container, false);
				adapter = new OrderCenterAdapter(getActivity(),section+"",mData1);
			}else if("1".equals(section+"")){
				mData2 = getData3();
				listView = (ListView) inflater.inflate(R.layout.fragment_order_center, container, false);
				adapter = new OrderCenterAdapter(getActivity(),section+"",mData2);
			}else if("2".equals(section+"")){
				mData3 = getData2();
				listView = (ListView) inflater.inflate(R.layout.fragment_order_center, container, false);
				adapter = new OrderCenterAdapter(getActivity(),section+"",mData3);
			}else if("3".equals(section+"")){
				mData4 = getData3();
				listView = (ListView) inflater.inflate(R.layout.fragment_order_center, container, false);
				adapter = new OrderCenterAdapter(getActivity(),section+"",mData4);
			}else if("4".equals(section+"")){
				mData5 = getData3();
				listView = (ListView) inflater.inflate(R.layout.fragment_order_center, container, false);
				adapter = new OrderCenterAdapter(getActivity(),section+"",mData5);
			}
			
			
			listView.setAdapter(adapter);
			
			return listView;
		}
		
	}
	
	public final class ViewHolder {
		public ImageView goods_img;
		public TextView product_title;
		public TextView shop_name;
		public TextView order_number;
		public TextView order_price;
		public TextView order_tv1;
		public TextView order_tv2;
		
	}
	
	//自定义ListView适配器
	class OrderCenterAdapter extends BaseAdapter{

		private LayoutInflater mInflater;
//		private List<Object> items;
		private String section; 
		private List<Map<String, Object>> mData;
		
		
		public OrderCenterAdapter(Context context,String section,List<Map<String, Object>> mData){
			mInflater = LayoutInflater.from(context);
//			items = new ArrayList<Object>();
			this.section=section;
			this.mData=mData;
		}
		
		public void addItems(List<Object> list){
			if(list != null && list.size() > 0){
//				items.add(list);
				notifyDataSetChanged();
			}
		}
		
		@Override
		public int getCount() {
			return mData.size();
		}

		@Override
		public Object getItem(int position) {
			return null;
//			return items.get(position);
		}

		@Override
		public long getItemId(int position) {
			return 0;
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {
			ViewHolder holder = null;
			if (convertView == null) {

				holder = new ViewHolder();
				convertView = mInflater.inflate(R.layout.order_center_listview,
						null);
				holder.product_title = (TextView) convertView
						.findViewById(R.id.product_title);
				holder.goods_img = (ImageView) convertView
						.findViewById(R.id.goods_img);
				holder.shop_name = (TextView) convertView
						.findViewById(R.id.shop_name);
				holder.order_number = (TextView) convertView
						.findViewById(R.id.order_number);
				holder.order_price = (TextView) convertView
						.findViewById(R.id.order_price);
				holder.order_tv1 = (TextView) convertView
						.findViewById(R.id.order_tv1);
				holder.order_tv2 = (TextView) convertView
						.findViewById(R.id.order_tv2);

				convertView.setTag(holder);
				

			} else {

				holder = (ViewHolder) convertView.getTag();
			}
			
			LinearLayout item_info=(LinearLayout) convertView.findViewById(R.id.item_info);
			item_info.setOnClickListener(new ItemClickListenerImpl((String) mData.get(position).get("order_number")));

			
			holder.goods_img.setBackgroundResource((Integer) mData.get(
					position).get("goods_img"));
			holder.product_title.setText((String) mData.get(position).get(
					"product_title"));
			holder.shop_name.setText((String) mData.get(position).get(
					"shop_name"));
			holder.order_number.setText((String) mData.get(position).get(
					"order_number"));
			holder.order_price.setText((String) mData.get(position).get("order_price"));
			
			//默认隐藏
			holder.order_tv1.setVisibility(View.INVISIBLE); //不显示,但是占位置
			holder.order_tv2.setVisibility(View.INVISIBLE); //不显示,但是占位置
			//全部
			if("0".equals(section)){
				
			}else if("1".equals(section)){//待付款
				holder.order_tv1.setVisibility(View.VISIBLE);
				holder.order_tv1.setText("取消订单");
				holder.order_tv2.setVisibility(View.VISIBLE);
				holder.order_tv2.setText("付  款");
			}else if("2".equals(section)){//待发货
				holder.order_tv1.setVisibility(View.VISIBLE);
				holder.order_tv1.setText("提醒发货");
			}else if("3".equals(section)){//已发货
				holder.order_tv1.setVisibility(View.VISIBLE);
				holder.order_tv1.setText("确认收货");
				holder.order_tv2.setVisibility(View.VISIBLE);
				holder.order_tv2.setText("查看物流");
			}else if("4".equals(section)){//待评价
				holder.order_tv1.setVisibility(View.VISIBLE);
				holder.order_tv1.setText("评  价");
			}
			
//			if(obj.status == "1"){
//				h.buttonLayout.setVisibility(View.VISIBLE);
//			}
//			Object obj = items.get(position);
			return convertView;
		}
		
	}
	
	//自定义ListView的Item监听事件
	private class ItemClickListenerImpl implements OnClickListener {
		private String testInfo;

		public ItemClickListenerImpl(String testInfo){
			this.testInfo=testInfo;
		}
		
		@Override
		public void onClick(View view) {
			Intent it = new Intent(OrderCenterActivity.this, OrderDetailActivity.class);   // 实例化Intent  
            it.putExtra("testInfo", "我的发送信息测试") ; // 设置附加信息  
            OrderCenterActivity.this.startActivityForResult(it, 1);                        // 启动Activity  
		}
	}
	
	/** 
     * 页卡切换监听 
     */  
    public class MyOnPageChangeListener implements OnPageChangeListener {  
  
		int one = offset * 2 + bmpW+2;// 页卡1 -> 页卡2 偏移量
		int two = one * 2;// 页卡1 -> 页卡3 偏移量
		int three = one * 3-1;
		int four = one * 4-2;
  
        @Override  
        public void onPageSelected(int arg0) {  
            Animation animation = null;  
            switch (arg0) {  
    		case 0:
    			if (currIndex == 1) {
    				animation = new TranslateAnimation(one, 0, 0, 0);
    			} else if (currIndex == 2) {
    				animation = new TranslateAnimation(two, 0, 0, 0);
    			} else if (currIndex == 3) {
    				animation = new TranslateAnimation(three, 0, 0, 0);
    			}else if (currIndex == 4) {
    				animation = new TranslateAnimation(four, 0, 0, 0);
    			}else{
    				animation = new TranslateAnimation(0, 0, 0, 0);
    			}
    			break;
    		case 1:
    			if (currIndex == 0) {
    				animation = new TranslateAnimation(offset, one, 0, 0);
    			} else if (currIndex == 2) {
    				animation = new TranslateAnimation(two, one, 0, 0);
    			} else if (currIndex == 3) {
    				animation = new TranslateAnimation(three, one, 0, 0);
    			}else if (currIndex == 4) {
    				animation = new TranslateAnimation(four, one, 0, 0);
    			}else{
    				animation = new TranslateAnimation(one, one, 0, 0);
    			}
    			break;
    		case 2:
    			if (currIndex == 0) {
    				animation = new TranslateAnimation(offset, two, 0, 0);
    			} else if (currIndex == 1) {
    				animation = new TranslateAnimation(one, two, 0, 0);
    			} else if (currIndex == 3) {
    				animation = new TranslateAnimation(three, two, 0, 0);
    			}else if (currIndex == 4) {
    				animation = new TranslateAnimation(four, two, 0, 0);
    			}else{
    				animation = new TranslateAnimation(two, two, 0, 0);
    			}
    			break;
    		case 3:
    			if (currIndex == 0) {
    				animation = new TranslateAnimation(offset, three, 0, 0);
    			} else if (currIndex == 1) {
    				animation = new TranslateAnimation(one, three, 0, 0);
    			} else if (currIndex == 2) {
    				animation = new TranslateAnimation(two, three, 0, 0);
    			}else if (currIndex == 4) {
    				animation = new TranslateAnimation(four, three, 0, 0);
    			}else{
    				animation = new TranslateAnimation(three, three, 0, 0);
    			}
    			break;
    		case 4:
    			if (currIndex == 0) {
    				animation = new TranslateAnimation(offset, four, 0, 0);
    			} else if (currIndex == 1) {
    				animation = new TranslateAnimation(one, four, 0, 0);
    			} else if (currIndex == 2) {
    				animation = new TranslateAnimation(two, four, 0, 0);
    			}else if (currIndex == 3) {
    				animation = new TranslateAnimation(three, four, 0, 0);
    			}else{
    				animation = new TranslateAnimation(four, four, 0, 0);
    			}
    			break;
    		}
              
            currIndex = arg0;  
            animation.setFillAfter(true);// True:图片停在动画结束位置  
            animation.setDuration(300);  
            cursor.startAnimation(animation);  
        }  
  
        @Override  
        public void onPageScrolled(int arg0, float arg1, int arg2) {  
        }  
  
        @Override  
        public void onPageScrollStateChanged(int arg0) {  
        }  
    }  
}

 

 

 

 

 

order_center.xml:

 

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:background="@drawable/main_header_bg"
            android:gravity="center_vertical"
            android:paddingLeft="10dp"
            android:paddingRight="10dp" >

            <ImageView
                android:id="@+id/header_back"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:src="@drawable/go_back" />
            <!-- 订单中心 -->

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_marginLeft="10dp"
                android:layout_toRightOf="@id/header_back"
                android:text="订单中心"
                android:textColor="@color/white"
                android:textSize="24sp" />

            <TextView
                android:id="@+id/refund_aftersales_tv"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_centerVertical="true"
                android:text="退款/售后"
                android:textColor="@color/white"
                android:textSize="18sp" />
        </RelativeLayout>
        <!-- 搜索信息 -->


        <!-- 搜索框 -->

        <FrameLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#F0EFF4"
            android:paddingBottom="6dp"
            android:paddingTop="8dp" >

            <EditText
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:background="@drawable/edittext_order_center_search"
                android:hint="搜索任务名或店铺名"
                android:paddingLeft="40dp" />
            <!-- 搜索按钮 -->

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="20dp"
                android:src="@drawable/order_center_search" />
        </FrameLayout>
        <!-- tab标签栏 -->

        <LinearLayout
            android:id="@+id/linearLayout1"
            android:layout_width="fill_parent"
            android:layout_height="40dp"
            android:background="#FFFFFF" >

            <!-- 全部 -->

            <TextView
                android:id="@+id/text1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="全部"
                android:textColor="#000000"
                android:textSize="16sp" />

            <View
                android:layout_width="2dp"
                android:layout_height="30dp"
                android:layout_gravity="center_vertical"
                android:background="#F3F2F6" />

            <!-- 待付款 -->

            <TextView
                android:id="@+id/text2"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="待付款"
                android:textColor="#000000"
                android:textSize="16sp" />

            <View
                android:layout_width="2dp"
                android:layout_height="30dp"
                android:layout_gravity="center_vertical"
                android:background="#F3F2F6" />

            <!-- 待取件 -->

            <TextView
                android:id="@+id/text3"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="待取件"
                android:textColor="#000000"
                android:textSize="16sp" />

            <View
                android:layout_width="2dp"
                android:layout_height="30dp"
                android:layout_gravity="center_vertical"
                android:background="#F3F2F6" />

            <!-- 已发货 -->

            <TextView
                android:id="@+id/text4"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="已发货"
                android:textColor="#000000"
                android:textSize="16sp" />

            <View
                android:layout_width="2dp"
                android:layout_height="30dp"
                android:layout_gravity="center_vertical"
                android:background="#F3F2F6" />

            <!-- 待评价 -->

            <TextView
                android:id="@+id/text5"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="待评价"
                android:textColor="#000000"
                android:textSize="16sp" />
        </LinearLayout>

        <!-- 左右移动线条 -->

        <ImageView
            android:id="@+id/cursor"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:scaleType="matrix"
            android:src="@drawable/tab_red_bottom" />

        <View
            android:layout_width="fill_parent"
            android:layout_height="8dp"
            android:layout_gravity="center_vertical"
            android:background="#F0EFF4" />

         <android.support.v4.view.ViewPager
	        android:layout_width="match_parent"
	        android:layout_height="match_parent"
	        android:id="@+id/viewPager" /> 
        <!--<ListView
            android:id="@+id/list_view"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:divider="#F0EFF4"
            android:dividerHeight="14dp" /> -->
    </LinearLayout>

</RelativeLayout>

 

 

 

 

 

fragment_order_center.xml:

 

<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/list_view"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:divider="#F0EFF4"
    android:dividerHeight="14dp"
    android:background="@color/white"
    android:orientation="vertical" >

    <!-- <ListView
        android:id="@+id/list_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:divider="#F0EFF4"
        android:dividerHeight="14dp" /> -->

</ListView>

 

 

 

 

 

order_center_listview.xml:

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
    android:orientation="vertical" >

    <!-- 店铺名称 -->

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginTop="10dp"
        android:gravity="center_vertical"
        android:orientation="horizontal" >

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:src="@drawable/house_black" />

        <TextView
            android:id="@+id/shop_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:textColor="#4A4A4A"
            android:textSize="18sp" />
    </LinearLayout>

    <View
        android:layout_width="fill_parent"
        android:layout_height="2dip"
        android:layout_gravity="center"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:background="#B6B6B6" />

    <LinearLayout
        android:id="@+id/item_info"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <!-- 商品图片 -->

        <ImageView
            android:id="@+id/goods_img"
            android:layout_width="80dip"
            android:layout_height="90dip"
            android:layout_margin="10dp"
            android:scaleType="centerInside"/>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <!-- 商品标题名称 -->

            <TextView
                android:id="@+id/product_title"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginRight="5dp"
                android:text="红玫瑰花束鲜花专卖店     生日鲜花    节日鲜花"
                android:textColor="@color/black"
                android:textSize="18sp" />

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/order_number"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textColor="#999999"
                    android:textSize="18sp" />
				
                <!-- 订单价格 -->
                <TextView
                    android:id="@+id/order_price"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_marginRight="10dp"
                    android:textColor="@color/order_price"
                    android:textSize="20sp" />
            </RelativeLayout>

            <!-- 按钮 -->
            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="15dp"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/order_tv1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:layout_marginRight="10dp"
                    android:background="@drawable/textview_style_pay"
                    android:textColor="@color/white"
                    android:textSize="18sp" />

                <TextView
                    android:id="@+id/order_tv2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_marginRight="15dp"
                    android:layout_toLeftOf="@id/order_tv1"
                    android:background="@drawable/textview_style_pay"
                    android:textColor="@color/white"
                    android:textSize="18sp" />
            </RelativeLayout>
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

 

 

  • 大小: 49.1 KB
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics