android UI的使用Word文档格式.docx

上传人:b****1 文档编号:243873 上传时间:2023-04-28 格式:DOCX 页数:32 大小:277.54KB
下载 相关 举报
android UI的使用Word文档格式.docx_第1页
第1页 / 共32页
android UI的使用Word文档格式.docx_第2页
第2页 / 共32页
android UI的使用Word文档格式.docx_第3页
第3页 / 共32页
android UI的使用Word文档格式.docx_第4页
第4页 / 共32页
android UI的使用Word文档格式.docx_第5页
第5页 / 共32页
android UI的使用Word文档格式.docx_第6页
第6页 / 共32页
android UI的使用Word文档格式.docx_第7页
第7页 / 共32页
android UI的使用Word文档格式.docx_第8页
第8页 / 共32页
android UI的使用Word文档格式.docx_第9页
第9页 / 共32页
android UI的使用Word文档格式.docx_第10页
第10页 / 共32页
android UI的使用Word文档格式.docx_第11页
第11页 / 共32页
android UI的使用Word文档格式.docx_第12页
第12页 / 共32页
android UI的使用Word文档格式.docx_第13页
第13页 / 共32页
android UI的使用Word文档格式.docx_第14页
第14页 / 共32页
android UI的使用Word文档格式.docx_第15页
第15页 / 共32页
android UI的使用Word文档格式.docx_第16页
第16页 / 共32页
android UI的使用Word文档格式.docx_第17页
第17页 / 共32页
android UI的使用Word文档格式.docx_第18页
第18页 / 共32页
android UI的使用Word文档格式.docx_第19页
第19页 / 共32页
android UI的使用Word文档格式.docx_第20页
第20页 / 共32页
亲,该文档总共32页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

android UI的使用Word文档格式.docx

《android UI的使用Word文档格式.docx》由会员分享,可在线阅读,更多相关《android UI的使用Word文档格式.docx(32页珍藏版)》请在冰点文库上搜索。

android UI的使用Word文档格式.docx

图片显示控件

<

!

--ImageView-图片显示控件-->

ImageViewandroid:

id="

@+id/imageView"

android:

layout_width="

wrap_content"

android:

layout_height="

>

<

/ImageView>

@Override

protectedvoidonCreate(BundlesavedInstanceState){

//TODOAuto-generatedmethodstub

super.onCreate(savedInstanceState);

this.setContentView(R.layout.imageview);

setTitle("

ImageView"

ImageViewimgView=(ImageView)this.findViewById(R.id.imageView);

//指定需要显示的图片

imgView.setBackgroundResource(R.drawable.icon01);

}

6.CheckBox:

复选框

7.RadioButton:

单选按钮

8.AnalogClock:

钟表(带表盘的那种)控件

protectedvoidonCreate(BundlesavedInstanceState){

//TODOAuto-generatedmethodstubsuper.onCreate(savedInstanceState);

this.setContentView(R.layout.analogclcok)

setTitle("

AnalogClock"

}

--AnalogClock-钟表(带表盘的那种)控件-->

AnalogClockandroid:

@+id/analogClock"

android:

/AnalogClock>

9.DigitalClock电子表控件

--DigitalClock-电子表控件-->

DigitalClockandroid:

@+id/digitalClock"

/DigitalClock>

this.setContentView(R.layout.digitalclcok);

DigitalClcok"

10.DatePicker日期选择控件

--DatePicker-日期选择控件-->

DatePickerandroid:

@+id/datePicker"

/>

this.setContentView(R.layout.datepicker);

//具体的应用可参见对话框中的示例

DatePicker"

11.TimePicker时间选择控件

--TimePicker-时间选择控件-->

TimePicker

@+id/timePicker"

/TimePicker>

this.setContentView(R.layout.timepicker);

TimePicker"

12.ToggleButton双状态按钮控件

--ToggleButton-双状态按钮控件

textOn-当按钮状态为true时所显示的文本

textOff-当按钮状态为false时所显示的文本

-->

ToggleButtonandroid:

@+id/toggleButton"

textOn="

关闭"

textOff="

打开"

ToggleButton"

finalToggleButtonbtn=(ToggleButton)this.findViewById(R.id.toggleButton);

//setOnClickListener()-响应按钮的鼠标单击事件

btn.setOnClickListener(newButton.OnClickListener(){

publicvoidonClick(Viewv){

TextViewtxt=(TextView)_ToggleButton.this.findViewById(R.id.textView);

//ToggleButton.isChecked()-双状态按钮的按钮状态

按钮状态:

"

+String.valueOf(btn.isChecked()));

13.ProgressBar进度条控件

//设置特性以允许在应用程序的标题栏上显示进度条(条状)requestWindowFeature(Window.FEATURE_PROGRESS);

//设置特性以允许在应用程序的标题栏上显示进度条(圆圈状)

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

this.setContentView(R.layout.progressbar);

ProgressBar"

//在标题栏上显示进度条(条状)

setProgressBarVisibility(true);

//在标题栏上显示进度条(圆圈状)

setProgressBarIndeterminateVisibility(true);

//指定进度条的进度

setProgress(50*100);

setSecondaryProgress(75*100);

--ProgressBar-进度条控件-->

--以下分别为大、中、小的进度条控件(圆圈状)-->

ProgressBarandroid:

@+android:

id/progress_large"

style="

?

attr/progressBarStyleLarge"

id/progress"

id/progress_small"

attr/progressBarStyleSmall"

--

进度条控件(条状)的演示

style-进度条的样式,本例使用内置样式

max-进度的最大值

progress-第一进度位置

secondaryProgress-第二进度位置

-->

@+id/progress_horizontal"

attr/progressBarStyleHorizontal"

200px"

max="

100"

progress="

50"

secondaryProgress="

75"

14.SeekBar:

可拖动的进度条控件

--SeekBar-可拖动的进度条控件

secondaryProgress-第二进度位置-->

SeekBarandroid:

@+id/seekBar"

fill_parent"

TextViewandroid:

@+id/progress"

@+id/tracking"

publicclass_SeekBarextendsActivityimplements

SeekBar.OnSeekBarChangeListener{

SeekBarmSeekBar;

TextViewmProgressText;

TextViewmTrackingText;

@Override

this.setContentView(R.layout.seekbar);

SeekBar"

mSeekBar=(SeekBar)findViewById(R.id.seekBar);

//setOnSeekBarChangeListener()-响应拖动进度条事件

mSeekBar.setOnSeekBarChangeListener(this);

mProgressText=(TextView)findViewById(R.id.progress);

mTrackingText=(TextView)findViewById(R.id.tracking);

//拖动进度条后,进度发生改变时的回调事件

publicvoidonProgressChanged(SeekBarseekBar,intprogress,

booleanfromTouch){

mProgressText.setText(progress+"

%"

//拖动进度条前开始跟踪触摸

publicvoidonStartTrackingTouch(SeekBarseekBar){

mTrackingText.setText("

开始跟踪触摸"

//拖动进度条后停止跟踪触摸

publicvoidonStopTrackingTouch(SeekBarseekBar){

停止跟踪触摸"

15.AutoCompleteTextView-支持自动完成功能的可编辑文本控件

AutoCompleteTextView

@+id/auto_edit"

>

/AutoCompleteTextView>

Button

@+id/btnname"

text="

@string/auto_btnname"

/Button>

publicclassTextextendsActivity{

AutoCompleteTextViewautoview;

ArrayAdapter<

String>

adapter;

//defaultcity

String[]city={

"

shanghai"

"

beijing"

tianjing"

wuhan"

sichuan"

};

publicvoidonCreate(BundlesavedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

intialView();

//default=2

autoview.setThreshold

(1);

Buttonbtn=(Button)findViewById(R.id.btnname);

btn.setOnClickListener(newOnClickListener(){

//TODOAuto-generatedmethodstub

Stringstring=autoview.getText().toString();

adapter.add(string);

});

publicvoidintialView(){

adapter=newArrayAdapter<

(this,

android.R.layout.simple_dropdown_item_1line,city);

autoview=(AutoCompleteTextView)findViewById(R.id.auto_edit);

autoview.setWidth(200);

autoview.setAdapter(adapter);

16.MultiAutoCompleteTextView:

支持自动完成功能的可编辑文本控件

--MultiAutoCompleteTextView

-支持自动完成功能的可编辑文本控件,允许输入多值(多值之间会自动地用指定的分隔符分开)

MultiAutoCompleteTextViewandroid:

@+id/editText"

publicclass_MultiAutoCompleteTextViewextendsActivity{

setContentView(R.layout.multiautocompletetextview);

setTitle("

MultiAutoCompleteTextView"

//实例化适配器,指定显示格式及数据源

adapter=newArrayAdapter<

this,

android.R.layout.simple_dropdown_item_1line,

ary);

MultiAutoCompleteTextViewtextView=(MultiAutoCompleteTextView)findViewById(R.id.editText);

textView.setAdapter(adapter);

//设置多个值之间的分隔符,此处为逗号

textView.setTokenizer(newMultiAutoCompleteTextView.CommaTokenizer());

//自动完成控件的所需数据的数据源

privateString[]ary=newString[]{

"

abc"

abcd"

abcde"

abcdef"

abcdefg"

hij"

hijk"

hijkl"

hijklm"

hijklmn"

};

17.ZoomControls:

放大/缩小按钮控件

--放大/缩小按钮控件-->

ZoomControlsandroid:

@+id/zoomControls"

publicclass_ZoomControlsextendsActivity{

this.setContentView(R.layout.zoomcontrols);

ZoomControls"

ZoomControlszoomControls=(ZoomControls)this.findViewById(R.id.zoomControls);

//setOnZoomInClickListener()-响应单击放大按钮的事件

zoomControls.setOnZoomInClickListener(newOnClickListener(){

Toast.makeText(_ZoomControls.this,"

单击了放大按钮"

Toast.LENGTH_SHORT).show();

//setOnZoomOutClickListener()-响应单击缩小按钮的事件

zoomControls.setOnZoomOutClickListener(newOnClickListener(){

单击了缩小按钮"

}}

18.Include将指定的layout整合进来

include-将指定的la

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2