⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ex08.java

📁 Google Android应用框架原理与程序设计 第三版(中文高清PDF)高焕堂
💻 JAVA
字号:
package com.misoo.ex08;import android.app.Activity;import android.os.Bundle;import android.widget.Button;import android.widget.ImageView;import android.widget.RelativeLayout;import android.widget.EditText;import android.widget.TableLayout;import android.widget.TableRow;import android.view.View;import android.view.ViewGroup;import android.view.View.OnClickListener;public class ex08 extends Activity implements OnClickListener {    private final int WC = ViewGroup.LayoutParams.WRAP_CONTENT;         @Override public void onCreate(Bundle icicle) {        super.onCreate(icicle);        RelativeLayout r_layout = new RelativeLayout(this);        setContentView(r_layout);        TableLayout tableLayout = new TableLayout(this);        r_layout.addView(tableLayout, new RelativeLayout.LayoutParams(WC, WC));        tableLayout.setId(1);                      TableRow tableRow1 = new TableRow(this);        tableLayout.addView(tableRow1, new TableLayout.LayoutParams(WC, WC));                ImageView iv = new ImageView(this);        tableRow1.addView(iv);        iv.setImageDrawable(getResources().getDrawable(R.drawable.star_big_on));        EditText edit1 = new EditText(this);        tableRow1.addView(edit1);        //-------------------------------------------------          TableRow tableRow2 = new TableRow(this);        tableLayout.addView(tableRow2, new TableLayout.LayoutParams(WC, WC));        ImageView iv2 = new ImageView(this);        iv2.setImageDrawable(getResources().getDrawable(R.drawable.gallery_photo_4));        tableRow2.addView(iv2);        EditText edit2 = new EditText(this);        tableRow2.addView(edit2);        //-------------------------------------------------          Button btn = new Button(this);        RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(WC, WC);        param.addRule(RelativeLayout.BELOW, 1);        param.topMargin = 20;        r_layout.addView(btn, param);        btn.setText("Exit");        btn.setOnClickListener(this);       }	public void onClick(View arg0) {		// TODO Auto-generated method stub	     finish();		} }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -