欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Android學(xué)習(xí)筆記-EditText&TextView&Button&菜單欄

Android學(xué)習(xí)筆記-EditText&TextView&Button&菜單欄

公司主營(yíng)業(yè)務(wù):網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、移動(dòng)網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出織金免費(fèi)做網(wǎng)站回饋大家。

界面文件activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.activity_03.MainActivity" >

    <EditText
        android:id="@+id/factor_one"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/symbol"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/factor_one" />

    <EditText
        android:id="@+id/factor_two"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/symbol" />

    <Button
        android:id="@+id/multiply"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/factor_two" />

</RelativeLayout>

界面文件result.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:orientation="vertical" >
    
<TextView 
    android:id="@+id/result"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    />
</LinearLayout>

MainActivity.java

public class MainActivity extends ActionBarActivity {

	private EditText factor_one;
	private EditText factor_two;
	private TextView symbol;
	private Button multiply;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        factor_one = (EditText) findViewById(R.id.factor_one);
        factor_two = (EditText) findViewById(R.id.factor_two);
        symbol = (TextView) findViewById(R.id.symbol);
        multiply = (Button) findViewById(R.id.multiply);
        
        symbol.setText(R.string.symbol);
        multiply.setText("計(jì)算");
        
        multiply.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				String factor_one_str = factor_one.getText().toString();
				String factor_two_str = factor_two.getText().toString();
				
				Intent intent = new Intent();
				intent.putExtra("factor_one_str", factor_one_str);
				intent.putExtra("factor_two_str", factor_two_str);
				
				intent.setClass(MainActivity.this, ResultActivity.class);
				MainActivity.this.startActivity(intent);
			}
		});
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {//設(shè)置菜單
    	//MenuItem android.view.Menu.add(int groupId, int itemId, int order, int titleRes)
    	menu.add(0, 1, 1, R.string.about);
    	menu.add(0, 2, 2, R.string.exit);
        return super.onCreateOptionsMenu(menu);
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {//選中菜單選項(xiàng)之后進(jìn)行的操作
    	if (item.getItemId() == 1) {//關(guān)于
			
		}else if (item.getItemId() == 2) {//退出
			finish();
		}
    	return super.onOptionsItemSelected(item);
    }

}

ResultActivity.java

public class ResultActivity extends Activity{
	
	private TextView result;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.result);
		String factor_one_str = getIntent().getStringExtra("factor_one_str");
		String factor_two_str = getIntent().getStringExtra("factor_two_str");
		
		int factor_one = Integer.parseInt(factor_one_str);
		int factor_two = Integer.parseInt(factor_two_str);
		
		result = (TextView) findViewById(R.id.result);
		result.setText(factor_one * factor_two + "");
	}
}

strings.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <string name="app_name">Activity_03</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="symbol">乘以</string>
	<string name="exit">退出</string>
	<string name="about">關(guān)于</string>
</resources>

AndroidManifest.xml 中注冊(cè)Activity

<activity android:name=".ResultActivity" android:label="ResultActivity"/>

文章標(biāo)題:Android學(xué)習(xí)筆記-EditText&TextView&Button&菜單欄
網(wǎng)站路徑:http://chinadenli.net/article34/ppsdpe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、小程序開發(fā)、用戶體驗(yàn)、自適應(yīng)網(wǎng)站、服務(wù)器托管、靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

h5響應(yīng)式網(wǎng)站建設(shè)
偷拍洗澡一区二区三区| 亚洲一区二区三区熟女少妇 | 韩国日本欧美国产三级| 激情中文字幕在线观看| 99久久国产综合精品二区| 久久亚洲国产视频三级黄| 日本精品中文字幕人妻| 国产无摭挡又爽又色又刺激| 午夜小视频成人免费看| 亚洲中文字幕亲近伦片| 亚洲另类女同一二三区| 亚洲国产四季欧美一区| 美国女大兵激情豪放视频播放| 亚洲精品成人午夜久久| 国产女优视频一区二区| 免费观看一区二区三区黄片| 欧美大黄片在线免费观看| 日韩一区二区三区高清在| 亚洲熟妇熟女久久精品| 大香蕉再在线大香蕉再在线| 欧美日韩无卡一区二区| 国产精品福利精品福利| 亚洲一区二区三区国产| 冬爱琴音一区二区中文字幕 | 国产情侣激情在线对白| 日韩女优精品一区二区三区| 国产欧美高清精品一区| 日韩免费国产91在线| 东京不热免费观看日本| 少妇人妻中出中文字幕| 国产一区二区三区不卡| 久久女同精品一区二区| 亚洲精品一二三区不卡| 日韩成人h视频在线观看| 欧美日韩综合在线第一页 | 污污黄黄的成年亚洲毛片| 五月情婷婷综合激情综合狠狠| 亚洲午夜精品视频观看| 老司机精品视频在线免费| 在线亚洲成人中文字幕高清| 成人免费观看视频免费|