The GetTextSize return value in TextView is in pixels (px) and settextsize () is in SP. so if you set it directly with the returned value, the workaround is to use a different form of settextsize (). Units can be specified:
When you inherit from view, when you draw bitmap, you need to put the picture in the new drawable-xdpi, otherwise the drawing size will be easily changed in the text underlined: Textview.getpaint (). SetFlags (Paint.strike_ Thru_text_flag); ScrollView is inherited from Framelayout, so framelayout is required when using Layoutparams
Several ways of network programming in Android: (1) socket for TCP/IP, ServerSocket (2) for UDP datagramsocket, Datagrampackage. It is important to note that, given that Android devices are usually handheld terminals, IP is distributed over the Internet. are not fixed. So the development is also a little different from ordinary Internet applications. (3) for direct URL httpurlconnection (4) Google integrates Apache HTTP client, which can be programmed using HTTP. Appache Http Core and HttpClient 4 are integrated for Http,google, so pay special attention to Android does not support HttpClient 3.x series, and currently does not support multipart (MIME), You need to add Httpmime.jar (5) Yourself to use Web Service. Android can support XMLRPC and JSONRPC through open source packages such as Jackson, or KSOAP2 to WebService (6) to display the page directly using the WebView view component. Based on the development of WebView, Google has provided a Web browser based on Chrome-lite that allows you to surf the Web directly.
Translateanimation (float Fromxdelta, float toxdelta, float fromydelta, float toydelta) This is one of our most common construction methods, float Fromxdelta : This parameter represents the difference between the point at which the animation starts and the current view x-coordinate, and the float Toxdelta, which represents the difference between the point at which the animation ends and the current view x-coordinate; float Fromydelta, which represents the point at which the animation starts from the current view The difference in the y-coordinate; float Toydelta) This parameter represents the difference between the point at which the animation starts and the current view y-coordinate, and if the view is at a (x, y) point, the animation is moved from point B (X+fromxdelta, Y+fromydelta) to point C (x+ Toxdelta,y+toydelta) point.
Android provides several ways to access the UI thread in other threads. Activity.runonuithread (Runnable) view.post (Runnable) view.postdelayed (Runnable, Long) Hanlderasynctask (recommended)
. Spinner can not be used in dialog and Tabhost solution Eclipse associated JDK Source code (1). "Window", "Preferences", "Java", "Installed JREs" (2) The right side of "Installed JREs" is the list pane, listing the JRE environment in the system, selecting your JRE, and clicking on "Edit ..." on the Edge, a window (edit JRE) (3) appears. Select this entry for the Rt.jar file: "c:\program Files\java\jre_1.5.0_06\lib\rt.jar "Dot to the left of the" + "sign to expand it, (4). After you expand, you can see" source Attachment: (None) ", click this item, point to the right of the button" source Attachment., select the "src.zip" file in your JDK directory
EditText setting the cursor position edittext There are some preset text in the time, want to put the cursor to the front, the beginning is the use of setselection (0), the results found in the Samsung P1000 above the problem. The study found that it was necessary to call Edittext.requestfocus () before calling SetSelection (0). Otherwise, there is a problem on the 2.x machine, but the 3.x is good.
The home key in Android is reserved by the system and cannot be used onkeydown like a fallback key. However, you can add your own processing code based on activity and view events that are triggered when the home key is pressed. Online Some people say can use Onattachwindow to intercept home button, never tried
When rendering with Surfaceview, you can put Surfaceview and other view in layout if you want to have other view in it when you need it, and you can hide other view in normal time.
Use Android:imeoptinos to make some interface settings on the soft keyboard that comes with Android: android:imeoptions= "Flagnoextractui" //Make the soft keyboard not full screen, only occupy a portion of the screen at the same time, this property can also control the display content of the soft keyboard lower right button, by default the return android:imeoptions= "Actionnone" //input box to the right without any hint android: imeoptions= "Actiongo" //Bottom right button content is ' start ' android:imeoptions= ' actionsearch ' ///lower right corner button for magnifier picture, search android:imeoptions= "Actionsend" //lower right button content for ' send ' android:imeoptions= ' actionnext ' //' Next ' button in the lower right corner android:imeoptions= "Actiondone" //Bottom right button content is ' done '
TextView add shadow <style name= "Overlay" > <item name= "android:paddingleft ">2dip</item> <item name=" Android:paddingbottom ">2dip</item> <item name=" Android : TextColor "> #ffffff </item> <item name=" android:textsize ">12sp</item> <item name= "Android:shadowcolor" > #00ff00 </item> <item name= "ANDROID:SHADOWDX" >5</item> <ite M name= "Android:shadowdy" >3</item> <item name= "Android:shadowradius" >6</item> </style > <textview android:id= "@+id/test" android:layout_width= "Fill_parent" android:layou t_height= "Wrap_content" style= "@style/<span style=" Background-color:rgb (250, 250, 250); Font-family:helvetica, Tahoma, Arial, Sans-serif; ">Overlay</span>" android:text= "test" android:gravity= "center"/>
How do I set the Chinese in TextView to bold? Use the android:textstyle= "bold" in the XML file to set the English to bold, but you cannot set the Chinese to bold, the Chinese is set to bold, the method is: TextView TV = (TextView) Findviewbyid ( R.ID.TEXTVIEW01); Textpaint TP = Tv.getpaint (); Tp.setfakeboldtext (TRUE);
Original address: http://www.blueowls.net/16%e6%9d%a1android%e5%bc%80%e5%8f%91%e5%b0%8f%e7%bb%8f%e9%aa%8c/
Common Tips for Android development