Android Learning Note 1

Source: Internet
Author: User
Tags add time

Getintent (). Getextras (). Get ("intent"); This intent is the parameter of the data wrapper. For example: Intent Intent = new Intent (this, youclass.class); Intent.putextra ("Data1", "Youdata"); Startactivit (Intent); Gets the data getintent (). Getextras (). Get ("data1");

No instantiation is like referencing only data and methods that are set as static methods in the class.

ListView in Onitemclick (adapterview<?> arg0, View arg1, int arg2, long arg3)? There are 4 parameters at the back, at first glance the direct halo of the dish, then what is the meaning of each parameter? For example, you will understand faster: X, y two listview,x there are 1,2,3,4 in these 4 item,y there are a,b,c,d 4 item. If you order b this item. as follows://ARG0 is equivalent to a pointer to the ListView y adapter, it can be used to get everything in Y, and then the more popular point is to tell you, you point y, not X//Arg1 is your point B this view handle, is you can use this view, To get the ID of the control in B. After the operation control//ARG2 is the position of B in the Y adapter (when the ListView is generated, the adapter makes the item one by one, and then puts them in the order of the queue and puts them in the ListView, meaning that this B is position)// Arg3 is the position of the first line of B in the ListView Y (obviously the 2nd line), most of the time the value of position and ID is the same, if necessary, you can add a log to the position and ID all out in Logcat.

The type Myintentservice must implement the inherited abstract method Intentservice.onhandleintent (Intent) Abstract methods are inherited must be implemented in the implementation of the method (abstract class, interface methods must be implemented)

span is an inline element; Div is a block-level element; they are all containers!

It is still very useful to layoutinflater this class in real-world development, which acts like Findviewbyid (). The difference is that Layoutinflater is used to find the XML layout file under res/layout/and is instantiated, while Findviewbyid () is looking for specific widget controls (such as button, TextView, and so on) under the XML layout file. Specific role: 1, for a non-loaded or want to dynamically load the interface, you need to use Layoutinflater.inflate () to load;

For an already loaded interface, you can use the Activiyt.findviewbyid () method to get the interface elements

About the properties of the Android Control FAQ align: Align parent: container bottom: Bottom alignparentbottom: Whether it appears at the bottom of the container. A value of TRUE or False android:layout_alignparentbottom= "true" this control has a bottom margin of 30dip which is the control and the control below him is 30dip android:layout_ Marginbottom= "30DIP" broadcast receiver is not allowed to open threads, so do not add time-consuming operations in OnReceive ()

Menu Usage: When your application target is set to a hive platform, you can use all the features provided by the Action Bar to place your Options menu item in the upper-right corner of the action Bar, which is more convenient for users, and the main menu item property that controls the behavior is Android:   Showasaction.   The acceptable values for this property are: 1, always: This value causes the menu item to be displayed on the action bar.   2. Ifroom: If there is enough space, this value causes the menu item to appear on the action bar.   3. Never: This value causes the menu item to never appear on the action bar. 4. Withtext: This value causes the menu item to be displayed along with its icon and the text of the menus.

Android:layout_centerhorizontal= "true"--places the control in the center of the horizontal direction

Relative layout: Other properties: android:layout_above= "@id/xxx"--place the control above the given ID control android:layout_below= "@id/xxx"--place the control under the given ID control android:layout_toleftof= "@id/xxx"-Aligns the right edge of the control with the left edge of the given ID control android:layout_torightof= "@id/xxx"-- Aligns the left edge of the control with the right edge of the given ID control android:layout_alignleft= "@id/xxx"-aligns the left edge of the control with the left edge of the given ID control android:layout_aligntop= "@id/xxx"- -Aligns the top edge of the control with the top edge of the given ID control android:layout_alignright= "@id/xxx"-Aligns the right edge of the control with the right edge of the given ID control android:layout_alignbottom= "@id/ XXX "-Aligns the bottom edge of the control with the bottom edge of the given ID control android:layout_alignparentleft=" true "-aligns the left edge of the control with the left edge of the parent control Android:layout_ Alignparenttop= "true"-aligns the top edge of the control with the top edge of the parent control android:layout_alignparentright= "true"-aligns the right edge of the control with the right edge of the parent control to Android: Layout_alignparentbottom= "true"-aligns the bottom edge of the control with the bottom edge of the parent control android:layout_centerinparent= "true"--places the control in the center of the parent control Android: Layout_centervertical= "true"--places the control in the vertical direction of the center bit android:layout_maginbottom= "10dip" is used to specify the distance from below

ListView Set Split Line properties: <listview android:id= "@+id/listview" android:layout_width= "Fill_parent" android:layout _height= "Fill_parent" android:divider= "#FFF" android:dividerheight= "1px" android:layout_margin= "10 The dip "/>-android:gravity is used to set the alignment of the contents of the view relative to the view component, and android:layout_gravity is used to set the alignment of the view component with respect to the container.

Color: Black #000000 maroon dark brown #800000 green #008000 Olive Olive #808000 Navy Navy #000080 Purple purple #800080 Teal water Duck Green #0 08080 Gray Grey #808080 silver #C0C0C0 red red #FF0000 Lime acid orange #00FF00 Yellow yellow #FFFF00 blue Blue #0000FF Fuchsia Magenta #FF00 FF Aqua Water Blue #00FFFF White #FFFFFF

About the title bar: Actionbar can implement titlebar and menu functions, to customize the titlebar, you have to define a theme and then import the new title layout in the program to full-screen two ways:

One is Android:theme= "@android: Style/theme.notitlebar.fullscreen"

There is also a android:theme= "@android: Style/theme.holo.noactionbar.fullscreen"

Android Learning Note 1

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.