android - 确认订单页面【仿】京东App

xml

  • activity_confirm
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:background="#33000000">

        <TextView
            android:id="@+id/tvLeft"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <Button
            android:id="@+id/bt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:background="#ff0000"
            android:text="立即下单" />
    RelativeLayout>
LinearLayout>

view层

  • ConfirmActivity
public class ConfirmActivity extends AppCompatActivity implements View.OnClickListener {
    private TextView mTvLeft;
    private Button mBt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_confirm);
        //接收传过来实付款
        Intent intent = getIntent();
        String money = intent.getStringExtra("money");
        initView();
        mTvLeft.setText("实付款:¥" + money);
    }

    private void initView() {
        mTvLeft = (TextView) findViewById(R.id.tvLeft);
        mBt = (Button) findViewById(R.id.bt);
        mBt.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            default:
                break;
            case R.id.bt:
                //跳转到订单页面
                Intent intent = new Intent(ConfirmActivity.this, OrderActivity.class);
                startActivity(intent);
                break;
        }
    }

你可能感兴趣的:(Android,Studio)