Android knowledge point Summary 1

Source: Internet
Author: User

<Activity android: name = ". LunchList"
Android: label = "@ string/app_name">
<Intent-filter>
<Action android: name = "android. intent. action. MAIN"/>
<Category android: name = "android. intent. category. LAUNCHER"/>
</Intent-filter>
<Intent-filter>
<Action android: name = "android. intent. action. SEARCH"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
<Meta-data android: name = "android. app. searchable"
Android: resource = "@ xml/searchable"/>
<Meta-data android: name = "android. app. default_searchable"
Android: value = ". LunchList"/>
</Activity>

<Activity android: name = ". LunchList"
Android: label = "@ string/app_name">
<Intent-filter>
<Action android: name = "android. intent. action. MAIN"/>
<Category android: name = "android. intent. category. LAUNCHER"/>
</Intent-filter>
<Intent-filter>
<Action android: name = "android. intent. action. SEARCH"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
<Meta-data android: name = "android. app. searchable"
Android: resource = "@ xml/searchable"/>
<Meta-data android: name = "android. app. default_searchable"
Android: value = ". LunchList"/>
</Activity> in the above Code,

[Html]
<Intent-filter>
<Action android: name = "android. intent. action. SEARCH"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>

<Intent-filter>
<Action android: name = "android. intent. action. SEARCH"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter> This is the registered implicit Intent filter. The second row indicates filtering intent with search action, the third row must be added. (If a custom Activity is to be started using an implicit intent, it must be added)

 

[Html]
<Meta-data android: name = "android. app. searchable"
Android: resource = "@ xml/searchable"/>

<Meta-data android: name = "android. app. searchable"
Android: resource = "@ xml/searchable"/> the default search framework is used to set the layout for the search box. The first line of name is given, the second line of resource is the layout you set for your search box, which is generally placed in res/xml.

 

[Html]
<Meta-data android: name = "android. app. default_searchable"
Android: value = ". LunchList"/>

<Meta-data android: name = "android. app. default_searchable"
Android: value = ". LunchList"/>

This is also related to the search. The above two are the intent received through intent_filter filtering and the layout of the search box displayed after the intent is received, however, the search can only be performed in the activity where you registered the meta-data node. If you want to enable the search framework in any activity, you must add this, the first row is also given, and the second row is used to specify which activity responds and execute the search and display the search results.


 

[Html]
<Cycler android: name = ". AppWidget"
Android: label = "@ string/app_name"
Android: icon = "@ drawable/icon">
<Intent-filter>
<Action android: name = "android. appwidget. action. APPWIDGET_UPDATE"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
<Meta-data
Android: name = "android. appwidget. provider"
Android: resource = "@ xml/widget_provider"/>
</Cycler>

<Cycler android: name = ". AppWidget"
Android: label = "@ string/app_name"
Android: icon = "@ drawable/icon">
<Intent-filter>
<Action android: name = "android. appwidget. action. APPWIDGET_UPDATE"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>
<Meta-data
Android: name = "android. appwidget. provider"
Android: resource = "@ xml/widget_provider"/>
</Cycler> in this code, a Widget is registered. The second line is the title of the widget, and the third line is its icon,

 

[Html]
<Intent-filter>
<Action android: name = "android. appwidget. action. APPWIDGET_UPDATE"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter>

<Intent-filter>
<Action android: name = "android. appwidget. action. APPWIDGET_UPDATE"/>
<Category android: name = "android. intent. category. DEFAULT"/>
</Intent-filter> This is similar to the previous one. It registers the intent filter and filters the update action of the widget. The third line explains the above, the updated actiong is placed in the implicit intent, so the third line must be added.

 

[Html]
<Meta-data
Android: name = "android. appwidget. provider"
Android: resource = "@ xml/widget_provider"/>

<Meta-data
Android: name = "android. appwidget. provider"
Android: resource = "@ xml/widget_provider"/> This is the parameter configuration for the widget. The second row is specified, and the third row is the custom widget parameter, put it in res/xml. The configuration here is as follows: res/xml/widget_provider.xml

[Html]
<Appwidget-provider xmlns: android = "http://schemas.android.com/apk/res/android"
Android: minWidth = "300dip"
Android: minHeight = "79dip"
Android: updatePeriodMillis = "1800000"
Android: initialLayout = "@ layout/widget"
/>

<Appwidget-provider xmlns: android = "http://schemas.android.com/apk/res/android"
Android: minWidth = "300dip"
Android: minHeight = "79dip"
Android: updatePeriodMillis = "1800000"
Android: initialLayout = "@ layout/widget"
/> The second, third, and fourth rows are width and update frequency, and the fifth line is the specific layout of the widget. The layout is the same as other layout Methods: res/layout/widget. xml

[Html]
<? Xml version = "1.0" encoding = "UTF-8"?>
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: background = "@ drawable/widget_frame"
>
<TextView android: id = "@ + id/name"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_centerVertical = "true"
Android: layout_alignParentLeft = "true"
Android: layout_toLeftOf = "@ + id/next"
Android: textSize = "10pt"
Android: textColor = "# FFFFFFFF"
/>
<ImageButton android: id = "@ + id/next"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_centerVertical = "true"
Android: layout_alignParentRight = "true"
Android: src = "@ drawable/ff"
/>
</RelativeLayout>

<? Xml version = "1.0" encoding = "UTF-8"?>
<RelativeLayout xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: background = "@ drawable/widget_frame"
>
<TextView android: id = "@ + id/name"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_centerVertical = "true"
Android: layout_alignParentLeft = "true"
Android: layout_toLeftOf = "@ + id/next"
Android: textSize = "10pt"
Android: textColor = "# FFFFFFFF"
/>
<ImageButton android: id = "@ + id/next"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_centerVertical = "true"
Android: layout_alignParentRight = "true"
Android: src = "@ drawable/ff"
/>
</RelativeLayout>

 


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.