由于最近项目需求,需要用到购物类型界面设计,于是仿了淘宝做了一下。
还没学会做gif图,图片先凑合看吧。这是主界面。布局代码如下。
布局很简单,就不多说明,然后就是mainactivity的代码了
package com.taobao.pll.tborderdemo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;
public class MainActivity extends Activity {
private RelativeLayout rl_person_alllist;//全部订单
private RelativeLayout rl_person_wait_pay;//待支付
private RelativeLayout rl_person_send;//待发货
private RelativeLayout rl_person_wait_get;//待收货
private RelativeLayout rl_person_aftermarket;//售后
private Intent intent;//需要启动的界面
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
initData();
}
private void initData() {
/**
* 全部订单
*/
rl_person_alllist.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent = new Intent(getApplicationContext(),OrderActivity.class);
intent.putExtra("page",0);
startActivity(intent);
}
});
/**
* 待支付
*/
rl_person_wait_pay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent = new Intent(getApplicationContext(),OrderActivity.class);
intent.putExtra("page",1);
startActivity(intent);
}
});
/**
* 待发货
*/
rl_person_send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent = new Intent(getApplicationContext(),OrderActivity.class);
intent.putExtra("page",2);
startActivity(intent);
}
});
/**
* 待收货
*/
rl_person_wait_get.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent = new Intent(getApplicationContext(),OrderActivity.class);
intent.putExtra("page",3);
startActivity(intent);
}
});
/**
* 售后
*/
rl_person_aftermarket.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
intent = new Intent(getApplicationContext(),OrderActivity.class);
intent.putExtra("page",4);
startActivity(intent);
}
});
}
private void initView() {
rl_person_alllist = (RelativeLayout) findViewById(R.id.rl_person_alllist);
rl_person_wait_pay = (RelativeLayout) findViewById(R.id.rl_person_wait_pay);
rl_person_send = (RelativeLayout) findViewById(R.id.rl_person_send);
rl_person_wait_get = (RelativeLayout) findVi