package com.example.traindemo; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; public class MoreActivity extends Activity implements OnClickListener { Button bt_ShiShiChaXun, bt_CheCiChaxun, bt_ZhanDaoZhanChaXun, bt_LieCheZhanDianLieBiao, bt_DingPiao1, bt_DingPiao2, bt_DaiShouDian, bt_ZhanToZhan_PiaoJia; public static ProgressDialog dlg; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.more); init(); } private void init() { bt_ShiShiChaXun = (Button) findViewById(R.id.button_ShiShiYuPiaoChaXun);// 12306实时余票查询 bt_CheCiChaxun = (Button) findViewById(R.id.button_CheCiChaxun);// 车次查询 bt_ZhanDaoZhanChaXun = (Button) findViewById(R.id.button_ZhanDaoZhanChaXun);// 站到站查询 bt_LieCheZhanDianLieBiao = (Button) findViewById(R.id.button_LeiCheZhanDianLieBiao);// 列车站点列表 bt_DingPiao1 = (Button) findViewById(R.id.button_DingPiao1);// 订票①:查询车次 bt_DingPiao2 = (Button) findViewById(R.id.button_DingPiao2);// 订票②:车次票价查询 bt_DaiShouDian = (Button) findViewById(R.id.button_DaiShouDian);// 火车票代售点查询 bt_ZhanToZhan_PiaoJia = (Button) findViewById(R.id.button_ZhanToZhan_PiaoJia);// 站到站查询(含票价) bt_ShiShiChaXun.setOnClickListener(this); bt_CheCiChaxun.setOnClickListener(this); bt_ZhanDaoZhanChaXun.setOnClickListener(this); bt_LieCheZhanDianLieBiao.setOnClickListener(this); bt_DingPiao1.setOnClickListener(this); bt_DingPiao2.setOnClickListener(this); bt_DaiShouDian.setOnClickListener(this); bt_ZhanToZhan_PiaoJia.setOnClickListener(this); dlg = new ProgressDialog(this); dlg.setMessage("jjjjjjjjjjjjjjjjjjjjjj"); } @Override public void onClick(View v) { Intent intent = null; switch (v.getId()) { case R.id.button_ShiShiYuPiaoChaXun:// 12306实时余票查询 // dlg.show(); intent = new Intent(MoreActivity.this, MainActivity.class); intent.putExtra("handle", 1); break; case R.id.button_CheCiChaxun:// 车次查询 intent = new Intent(MoreActivity.this,CheCiChaxun.class); break; case R.id.button_ZhanDaoZhanChaXun:// 站到站查询 intent = new Intent(MoreActivity.this,ZhanDaoZhanChaXun.class); break; case R.id.button_LeiCheZhanDianLieBiao:// 列车站点列表 break; case R.id.button_DingPiao1:// 订票①:查询车次 break; case R.id.button_DingPiao2:// 订票②:车次票价查询 break; case R.id.button_DaiShouDian:// 火车票代售点查询 break; case R.id.button_ZhanToZhan_PiaoJia:// 站到站查询(含票价) break; default: break; } startActivity(intent); } }
more.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:background="@drawable/logo" android:gravity="center_vertical" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/button_CheCiChaxun" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="车次查询" /> <Button android:id="@+id/button_ZhanDaoZhanChaXun" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="站到站查询" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" > <Button android:id="@+id/button_ShiShiYuPiaoChaXun" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="实时余票查询" /> <Button android:id="@+id/button_LeiCheZhanDianLieBiao" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="列车站点列表" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" > <Button android:id="@+id/button_DingPiao1" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="订票①:查询车次" /> <Button android:id="@+id/button_DaiShouDian" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="火车票代售点查询" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" > <Button android:id="@+id/button_DingPiao2" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="订票②:车次票价查询" /> <Button android:id="@+id/button_ZhanToZhan_PiaoJia" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="站到站查询(含票价)" /> </LinearLayout> </LinearLayout>
时间: 2024-11-01 21:35:24