第十一课

文本
用在文本设置属性
android:id=“e+id/tvname”
android:text=""@string/tvname">
图片
1.建立图片资源将图片复制到drawable文加下;系统默认给资源建立R类ID,drawable/文件名
样式资源
组件、布局的样式设置:样式文件里设置(css文件)
使用自定义式:style="@style/mystyle""
与网页css效果一样。

布局样式
 在其他布局件中引入自定义的布局文件。 <?xm1 version=""1.0" encoding=""utf-8""?> 
<LinearLayout xm1ns : android=“http: / /schemas . android.com/apk/res/android”"
 android:orientation=“vertica1” android:1ayout_width=“match_parent"android:1ayout_height=“match_parent”>
 Button
 android:layout_width=”“wrap_content"android:1ayout_height=”“wrap_content”“android:text=按钮”">




选择器起源
设置按钮或者其他组件可以有不同状态时显示不用效果

1.建立选择起源:类型drawable
 ⒉设置组件状态样式
 3.andiroid:background="@drawable/btn_test"" <?xm1 version="1.0"encoding=""utf-8""?> 
<selector xm1ns :androidm"“http: / /schemas .android.com/apk/res /android”">
 <item android:state_pressed=“true” android: drawable=“ecoTor/cc1orAccent”/sd!–pressed -->
 <item android:state_focused=“true” android:drawable=“ecolor /cclorakccent” /)ss–focused -->
 citem android:state_hovered=“true” android: drawable=”@co1or/co1orAccent”/st–hovered -->

Android高级组件
 AutocompleteTextView

.Notification
.Notification,是一种具有全局效果的通知,可以在系统的通知栏中显示。当APP向系统发出通知时,它将先以图标的形式显示在通知栏中。用户可以下拉通知栏查看通知的详细信息。通知栏和抽屉式通知栏均是由系统控制,用户可以随查看。
·显示接收到短消息、及时消息等信息(如QQ、微信、新浪、短信)l
·显示客户端的推送消息,如广告、优惠、版本更新、推荐新闻等,常用的三方SDK有:JPush 、个推、信鸽、网易云信(偏重IM )、阿里云·显示正在进行的事物,例如:后台运行的程序,如音乐播放进度、下载进度·其中,前两点可以归结为与用户交互,第三点是实时的任务提醒,但不可否定的是,第三点也会与用户交互。
·创建一个简单的Notification 。主要有以下三步:

·获取NotificationManager 实例
 ·实例化 NotificationCompat.Builder并设置相关属性
 ·通过 builder.build()方法生成Notification对象,并发送通知
 ·小图标,通过setSmallIcon()方法设置
 ·标题,通过 setContentTitle()方法设置
 ·内容,通过setContentText()方法设置·//获取NotificationManager实例
 .NotificationManager notifyManager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
 ·//实例化NotificationCompat.Builde并设置相关属性
 .NotificationCompat.Builder builder = new NotificationCompat.Builder(this)//设置小图标.setSmallIcon(R.mipmap.icon_fab_repair)
 //设置通知标题.setContentTitle(“最简单的Notification”)·//设置通知内容.setContentText(“只有小图标、标题、内容”)·//设置通知时间,默认为系统发出通知的时间,通常不用设置//.setWhen(System.currentTimeMillis());
 ·//通过builder. build()方法生成Notification对象,并发送通知, id=l notifyManager.notify(1,builder.build0);

自动完成文本框
·自动完成文本框(AutoCompleteTextView)实际上也是一个编辑文本框,但它比普通编辑框多了一个功能:当用户输入一定字符后,自动文本框会显示一个下拉菜单,供用户从中选择,当用户选择某个菜单选项之后,AutoCompleteTextView按用户选择自动填写该文本框。

自动完成文本框(AutoCompleteTextView)

android 重新设置高度surfaceview android高级设置_sed


<AutocompleteTextView
 android:id="“esid/autv“
 android:layout_width=“match_parent”“android:layout_height=”“wrap_eontent”“android:completinotallow=”“输入信息…”“android:completionThresho1d=”“1"”
 android:popupTheme=”“ecolor/cardview_dark_background”">
 </ AutocompleteTextview>
 tv=findviewByIdCR.id.autv);//创建数据源适配器
 ArrayAdapter adapter=new
 ArrayAdapter (MainActivity.this[, android.R.1ayout.simp1e_list_item_1,data);//适配器
 tv.setAdapter(adapter);Spinner点击事件: setOnltemSelectedListener()
 android:entries数据源

android 重新设置高度surfaceview android高级设置_android_02


Spinner:下拉列表

. Spinner提供了从一个数据集合中快速选择一项值的办法。默认情况下Spinner显示的是当前选择的值,点击Spinner会弹出一个包含所有可选值的

dropdown菜单,从该菜单中可以为Spinner选择一个新值。