Android 10

Android Advanced Components
1. How to use Java code
Resources res = getResources();
res. Getcolor (R. Color.
Orchid ); res.getstring(R.string.app_name);
res.getLayout(R.layout.activity_main);
res . getDrawable (R. drawable. grid);
res.getstringArray(R.array.arrtest)
src: store all *Java source programs
gen: save path for code files automatically generated by ADT plug-in, inside R.java will save all The resource ID.
assets: You can store some larger resource files of the project, such as pictures, music, fonts, etc.
res: can store all resource files in the project, such as pictures (.png, jpg), text, etc.
res/drawable-hdpi: save high-resolution image resources, you can use Resources.getDrawable(id) to get the resource type.
res/drawable-ldpi: save low-resolution image resources, you can use Resources.getDrawable(id) to get the resource type.
res/drawable-mdpi: save medium-resolution image resources, you can use Resources.getDrawable(id) to get the resource class
res/layout: store all layout files, mainly used to arrange different display components, in the Android program Read this configuration.
res/values: Store the information of some resource files, used to read text resources, there are some agreed file names in this folder:
arrays.xml: define the array data; (you can name it when you name this xml because time and finally just used to write in this
one xml file array of name)

2. The advanced component
Notification is a notification with global effects, which can be displayed in the notification bar of the system. When the APP sends a notification to the system,
it will first be displayed in the notification bar as an icon. The user can pull down the notification bar to view the detailed information of the notification.
Both the notification bar and the notification drawer are controlled by the system, and users can view and
create a simple Notification at any time . There are three main steps:
get the NotificationManager instance,
instantiate the NotificationCompat.Builder and set the relevant properties.
Generate the Notification object through the builder.build() method, and send the notification
small icon, set the
title through the setSmallIcon() method , and set the
content through the setContentTitle() method , Set by the setContentText() method

获取NotificationManager实例
·NotificationManager notifyManager=(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);

Instantiate NotificationCompat.Builde and set the relevant properties
·NotificationCompat.Builder builder=new NotificationCompat.Builder(this)//Set
small.setSmallIcon(R.mipmap.icon_fab_repair) to
set the notification title.setContentTitle("the simplest Notification") to
set the notification Content.setContentText("only small icon, title, content")
sets the notification time, the default is the time when the system sends the notification, usually there is no need to set the
setWhen(System.currentTimeMillis();
to generate the Notification object through the builder.build() method and send it Notification, id=1 notifyManager.notif
builder build().

AutoCompleteTextView (AutoCompleteTextView)

Guess you like

Origin blog.51cto.com/14589602/2641119