package com.gourmetMeal;
import android.os.Bundle;
import android.content.Intent;import android.view.KeyEvent;import android.view.View;import android.view.View.OnClickListener;import android.widget.Button;public class MenuintroduceActivity extends CommonActivity implements OnClickListener { /** * 确定按钮 */ private Button menuintroducere_btn_ok; /** * 声明Intent跳转 */ private Intent menuintroducere_intent;@Override
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_menuintroduce); // 初始化UI infoUI(); }/**
* 初始化UI */ private void infoUI() { /* * 获得UI控件 */ menuintroducere_btn_ok = (Button) findViewById(R.id.menuintroducere_btn_ok); menuintroducere_intent = new Intent();/*
* 设置监听事件 */ menuintroducere_btn_ok.setOnClickListener(MenuintroduceActivity.this); }/**
* 按钮点击事件 */ public void onClick(View v) { switch (v.getId()) { case R.id.menuintroducere_btn_ok: // 确定按钮 /* * 跳转至主界面 */ menuintroducere_intent.setClass(MenuintroduceActivity.this, MenuActivity.class); startActivity(menuintroducere_intent); this.finish(); break; } }/**
* 重写返回键 */ @Override public boolean onKeyDown(int keyCode, KeyEvent event) { /* * 跳转至主界面 */ if (keyCode == KeyEvent.KEYCODE_BACK) { menuintroducere_intent.setClass(MenuintroduceActivity.this, MenuActivity.class); startActivity(menuintroducere_intent); this.finish(); } return false; }}Xml:
<RelativeLayout xmlns:android=""
xmlns:tools="" android:background="@drawable/menu_background" android:layout_width="match_parent" android:layout_height="match_parent" ><RelativeLayout
android:id="@+id/menuintroducere_lativeLayout_above" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:layout_marginTop="20dp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" ><TextView
android:id="@+id/menuintroducere_txt_above" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:text="菜品详细信息" /><TextView
android:id="@+id/menuintroducere_txt_below" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/menuintroducere_scrollView" android:text="我的打分" /><RatingBar
android:id="@+id/ratingBar1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/menuintroducere_txt_below" /><ScrollView
android:id="@+id/menuintroducere_scrollView" android:layout_width="wrap_content" android:layout_height="50dp" android:layout_alignParentLeft="true" android:layout_below="@+id/menuintroducere_txt_above"><LinearLayout
android:layout_width="match_parent" android:layout_height="match_parent" ><TextView
android:id="@+id/menuintroducere_txt_information" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="************************************************************************************"android:inputType="textMultiLine"/>
</LinearLayout> </ScrollView> </RelativeLayout><RelativeLayout
android:id="@+id/menuintroducere_lativeLayout_center" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:layout_above="@+id/menuintroducere_lativeLayout_below" android:layout_below="@+id/menuintroducere_lativeLayout_above" ><EditText
android:id="@+id/menuintroducere_etxt_result" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:inputType="textMultiLine"><requestFocus />
</EditText></RelativeLayout>
<RelativeLayout
android:id="@+id/menuintroducere_lativeLayout_below" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_marginLeft="40dp" android:layout_marginRight="40dp" android:layout_marginBottom="10dp" ><Button
android:id="@+id/menuintroducere_btn_ok" android:textColor="#FFFFFF" android:background="@layout/button_ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_marginTop="10dp" android:layout_alignParentRight="true" android:text="" /></RelativeLayout>
</RelativeLayout>