日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當(dāng)前位置:首頁(yè) > 芯聞號(hào) > 充電吧
[導(dǎo)讀]public class TextView extends View implements ViewTreeObserver.OnPreDrawListener java.lang.Object

public class TextView extends View implements ViewTreeObserver.OnPreDrawListener java.lang.Object ???? android.view.View ? ???? android.widget.TextViewKnown Direct Subclasses Button,CheckedTextView,Chronometer,DigitalClock,EditText,TextClock Button Represents a push-button widget.? CheckedTextView An extension to TextView that supports the Checkable interface.? Chronometer Class that implements a simple timer.? DigitalClockThis class was deprecated in API level 17. It is recommended you useTextClock instead.? EditText EditText is a thin veneer over TextView that configures itself to be editable.? TextClock

TextClock can display the current date and/or time as a formatted string.?

Known Indirect Subclasses AutoCompleteTextView,CheckBox,CompoundButton,ExtractEditText,MultiAutoCompleteTextView,RadioButton,Switch,ToggleButton

1、fill_parent與match_parent Android2.2開始兩者相同,2.2之前用fill_parent,官方推薦match_parent。

2、layout_gravity與gravity 2.1)gravity:指定控件中文字的對(duì)齊方式。 layout_gravity:指定控件在所在布局中的對(duì)齊方式。 LinearLayout中: orientation:vertical時(shí):layout_gravity水平方向的設(shè)置有效:left/right/center_horizontal orientation:horiaontal時(shí):layout_gravity垂直方向設(shè)置有效:top/bottom/center_vertical. ?center 都可以用,總有一個(gè)方向生效 2.2)想要設(shè)置某個(gè)控件居底,可以在空間外加一層LinearLayout并設(shè)置其gravity為bottom.

3、Button點(diǎn)擊事件 3.1)XML:

public?void?onClick(View?view){
}

3.2)?

?login_btn.setOnClickListener(new?OnClickListener(){
			@Override
			public?void?onClick(View?view){
		}
				
			}
		});//匿名類的方式

3.3)

public?class?MainActivity?extends?Activity?implements?onClickListener{
?????@Override
?????protected?void?onCreate(Bundle?savedInstanceState){
??????super.onCreate(savedInstanceState);
??????Button?button?=?(Button)findViewById(R.id.button);
?????button.setOnClickListener(this);
}
??@Override
??public?void?onClick(View?view){
}
}

3.4)

??
????????Button?Btn?=?(Button)?findViewById(R.id.button);??
????????Btn2.setOnClickListener(listener);//設(shè)置監(jiān)聽????
??
????}??
??
????Button.OnClickListener?listener?=?new?Button.OnClickListener(){//創(chuàng)建監(jiān)聽對(duì)象????
????????public?void?onClick(View?v){????
????????
????????}????
??
????};

4、EditText 當(dāng)需要輸入EditText中的內(nèi)容過多時(shí),可以指定最大行數(shù),當(dāng)達(dá)到最大行數(shù)時(shí)文本就會(huì)往上滾動(dòng)。

android:maxLines="2"

5、ProgressBar/AlertDialog/ProgressDialog

 
//AlertDialog/ProgressDialog
@Override
	public?boolean?onCreateOptionsMenu(Menu?menu)?{
		//?Inflate?the?menu;?this?adds?items?to?the?action?bar?if?it?is?present.
		getMenuInflater().inflate(R.menu.main,?menu);
		return?true;
	}

	@Override
	public?boolean?onOptionsItemSelected(MenuItem?item)?{
		//?Handle?action?bar?item?clicks?here.?The?action?bar?will
		//?automatically?handle?clicks?on?the?Home/Up?button,?so?long
		//?as?you?specify?a?parent?activity?in?AndroidManifest.xml.
		int?id?=?item.getItemId();
		switch(id){
		case?R.id.alertDialog:
			?AlertDialog.Builder?alertDialog?=?new?AlertDialog.Builder(this);
			?alertDialog.setTitle("Warning");
			?alertDialog.setMessage("This?is?a?warning");
			?alertDialog.setPositiveButton("OK",?new?DialogInterface.OnClickListener()?{
				
				@Override
				public?void?onClick(DialogInterface?dialog,?int?which)?{
					//?TODO?Auto-generated?method?stub
					
				}
			});
			?alertDialog.setNegativeButton("Cancel",?new?DialogInterface.OnClickListener()?{
				
				@Override
				public?void?onClick(DialogInterface?dialog,?int?which)?{
					//?TODO?Auto-generated?method?stub
					
				}
			});
			?alertDialog.show();
			?break;
		case?R.id.progressDialog:
			ProgressDialog?progressDialog?=?new?ProgressDialog(this);
			progressDialog.setTitle("ProgressDialog");
			progressDialog.setMessage("loading...");
			progressDialog.show();
			break;
		default:
		}


		return?super.onOptionsItemSelected(item);
	}






本站聲明: 本文章由作者或相關(guān)機(jī)構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點(diǎn),本站亦不保證或承諾內(nèi)容真實(shí)性等。需要轉(zhuǎn)載請(qǐng)聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請(qǐng)及時(shí)聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關(guān)閉