Android Basics (4)

Source: Internet
Author: User

4. Basic knowledge

Gravity the alignment of the child elements contained by the control component
Layout_gravity controls how the component is aligned in the parent element

http://blog.csdn.net/u014450015/article/details/46714323 view and the concept of ViewGroup
http://blog.csdn.net/u014450015/article/details/46716219 LinearLayout
http://blog.csdn.net/u014450015/article/details/46728527 Relativelayout
http://blog.csdn.net/u014450015/article/details/46728547 Tablelayout
http://blog.csdn.net/u014450015/article/details/46728573 Framelayout
http://blog.csdn.net/u014450015/article/details/46728603 GridLayout
http://blog.csdn.net/u014450015/article/details/46728627 Absolutelayout

GetWidth (): View the width of the entire view after setting the layout.
Getmeasuredwidth (): The width of the view content that is obtained when the content on the view is measured, if you must call measure (0,0) in the parent layout's OnLayout () method or in the OnDraw () method of this view;( You can define the values of the parameters in measure, otherwise you get the same results as the getwidth ().


Http://www.tuicool.com/articles/iaeQ3aR Android app uses custom fonts for some exploration

Http://www.tuicool.com/articles/Y7jEry2 Android Custom Message push
Loop traversal speed
First
for (String s:tests) {
// ....
}
The second Kind

int size = Tests.size ();
for (int i = 0; i < size; i++) {
Tests.get (i);
}
Third Kind

Iterator<string> it = Tests.iterator ();
while (It.hasnext ()) {
It.next ();
}

Small data under 100 does not matter, big data under the second type is the best (10000 above)


Get URL
Final URI uri = uri.parse ("Intbird://com.intbird.soft/testing/tested?name= ' Test '");
TextView TextView = (TextView) Findviewbyid (R.id.textview);
Textview.settext (Uri.getscheme () + "\ n"//intbird
+ uri.getport () + "\ n"//-1
+ uri.getauthority () + "\ n"//com.intbird.soft
+ uri.gethost () + "\ n"//com.intbird.soft
+ Uri.getpath () + "\ n"///testing/tested
+ uri.getpathsegments () + "\ n"//[tesing,tested]
+ uri.getquery () + "\ n"); Name= ' Text '

In the official Android documentation, we recommend that we do registerreceiver in Onresume, Unregisterreceiver in OnPause,


Android experience high-scale art-like adapter Http://www.tuicool.com/articles/veAbiiU Baseadapter


Detailed dpi/dp/sp http://www.tuicool.com/articles/77ra2q commonly used in Android development


Application class

public class App extends application {
private static APP instance;
Private Map Innermap = new HashMap ();
@Override
public void OnCreate () {
Super.oncreate ();
Instance = this;//Note here, is not a common single-case approach
}
public static App getinstance () {
LOG.V ("App", "getinstance instance" +instance.tostring ());
return instance;
}
public void AddParam (Object key,object value) {
Innermap.put (key, value);
}
public object GetParam (object key) {
return Innermap.get (key);
}
}


Data Read-only
//cache read-only data
private Object readonlydata;
@Override
protected void OnCreate (Bundle Savedinstancestate) {
Super.oncreate (savedinstancestate);
//Read data to memory
Readonlydata = Readonlydata ();
}
Private Object Readonlydata () {
return null;
}
@Override
protected void OnDestroy () {
Super.ondestroy ()
//Data is empty, accelerated reclamation
Readonlydata = null;
}


Write
Cache data that can be read and written
Private Object data;
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Read data to Memory
data = ReadData ();
}
@Override
protected void Onresume () {
Super.onresume ();
data = ReadData ();
}
Private Object ReadData () {
TODO Read Data
return null;
}
private void WriteData (Object data) {
TODO writes data
}
@Override
protected void OnPause () {
Super.onpause ();
WriteData (data);
}
@Override
protected void OnDestroy () {
Super.ondestroy ();
Empty the data to speed up recycling
data = null;
}


Android cultivation path-Get the soft keyboard height Http://www.tuicool.com/articles/MNVJZjY Inputmethodmanager

Android learns the use of shape by drawing a dashed oval border background with code Http://www.tuicool.com/articles/INrEbua


Android major network Request library comparison and actual combat Http://www.tuicool.com/articles/Yjq6niQ
HttpURLConnection HttpClient Android Asynchronous Http Client Volley OkHttp Retrofit

Android Custom Control Http://www.tuicool.com/articles/7V3iMjn


Statelistdrawable,layerdawable,clipdrawable,animationdarwable Introduction to Android Http://www.tuicool.com/articles/EfqAbmA


Android Image Chapter Http://www.tuicool.com/articles/UjEnUfy

Android Custom Line Wrap Center Centertextview HTTP://WWW.TUICOOL.COM/ARTICLES/NZNUZM

Http://www.tuicool.com/articles/R322iiM Android Bitmap loading with pixel operation

Http://www.tuicool.com/articles/IFf6Fj Android Shape Properties Detailed finishing

Http://www.tuicool.com/articles/UJbayuy Retrieving whether Android installs an app

Http://www.tuicool.com/articles/YBFJNvY classes related to Android interface (Window WindowManager Display displaymetrics)

Http://www.tuicool.com/articles/AzIJfeN Full analysis of Android event processing (dispatchtouchevent, ontouchevent, onintercepttouchevent)

Http://www.tuicool.com/articles/NBZFjam Android UI Details Knowledge Point one (EditText, ListView, Fill screen, etc.)

Http://www.tuicool.com/articles/rmMBjuu Android Memory optimized bitmap memory footprint calculation

HTTP://WWW.TUICOOL.COM/ARTICLES/JABMU2Y Android Memory optimized bitmap optimal loading

Http://www.tuicool.com/articles/EBFZbyF the execution of functions in Android view

Http://www.tuicool.com/articles/zAr2Mf Http://www.tuicool.com/articles/6zArmeY Android The most fire rapid development framework Androidannotations use of the detailed

Http://www.tuicool.com/articles/YbMVNzB Rapid Development framework of Android framework Xutil

Http://www.tuicool.com/articles/ymmyuyU Android's official navigation bar Actionbar style settings

Android Basics (4)

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.