Android FAQ and development experience summary (3)
1. Space placeholder adjustment style problems
Number, letter, and Chinese Character Placement Problem: All numbers and letters are divided into different types. In most cases, because our input is half-width, the placeholder values of letters and numbers cannot be determined. However, once fully divided, the placeholder values of numbers and letters are the same as those of a Chinese character, in this way, the layout problem caused by placeholder can be avoided.
2. more convenient and concise debugging of a slightly Complex layout with RelativeLayout Layout
3. Use android: layout_weight or TableLayout to create an equal-score layout during the same-score layout.
4. English Document Layout: When textview is automatically changed, the word integrity should be maintained. The solution is to calculate the string length, and then manually set the number of letters displayed in each row with '\ n' added '.
5. Do not perform time-consuming operations in the main thread, for example, database operation File Operation Request server operation.
6. styles. xml: extract the styles that are repeatedly reproduced in layout to a common style component and put it in styles. xml.
7. Special usage of string. xml
For example, "I am 23 years old this year", and this 23 is an integer. This can be written in string. xml, I'm % 1 $ d this year
String sAgeFormat = getResources().getString(R.string.old); String sFinalAge = String.format(sAgeFormat, 23);
Label introduction:
% N $ ms: indicates that the output is a string, and n indicates the number of parameters. The m value can be set with spaces before the output.
% N $ md: indicates that the output is an integer, and n indicates the number of parameters. To set m, you can place a space before the output, or set it to 0 m, put m 0 before output
% N $ mf: indicates that the output is a floating point number, and n indicates the number of parameters. Setting the m value can control the number of decimal places. For example, when m = 2.2, the output format is 00.00.
You can also write it as follows:
% D (integer)
% F (floating point number)
% S (string)