Original: http://blog.csdn.net/tanghongchang123/article/details/52982818
First, the basic command:
1. ADB connect [IP]
2. ADB disconnect [IP]
3. ADB uninstall [Package]
4. ADB shell Input Text * * *: Used to enter text, in the debugging program, in many cases to type text, mobile phone input convenient, TV, with the remote control by the keyboard very troublesome, you can use this command.
Second, focus control
1. Control whether the control can get focus
android:focusable="True/false" when this property is set to True, indicates that the current control can have the focus, or vice versa. You can also set it through code in your program:
V.setfocusable (true/false);
2, control the remote control by the left and right of the current one to get focus
- android:nextfocusup=
- android:nextfocusdown= "@+ ID/... " 
- android:nextfocusleft= "@+id/..."
- android: Nextfocusright= "@+id/..."
- The following is a program setting
- v.setnextfocusup (ID);
- v.setnextfocusdown (ID);
-
- V.setnextfocusright (ID);
-
V.setnextfocusright (ID);
3, TV resolution of the adaptation problem
If the adaptation is not correct, an oom (out of memory) problem is prone to occur. According to the existing TV situation, the general recommended setting
Drawable-sw1080dp
Drawable-sw720dp
Correspondingly, the size of the corresponding resolution is provided:
Values-sw1080dp
Values-sw720dp
For example the same is 1080P, some 32 inches, some 42 inches. Small size, high dpi, so that the picture will be compressed. In the values file, you can use the DP, PIX, and the default DPI is 160. You can also consider the values using PX verification.
4, Shadow, reflection of the program implementation (completely can be implemented by the art, here the code for reference only)
Reflection principle: Basically is the original image inverted, painted on the canvas, and then add a translucent mask.
Shadow effect: There are a lot of tutorials on the web that tell you about shadows, and what you do here is a shadow effect around the picture of a rounded rectangle. The way to do this is to add a rectangular shadow to each of the original edges, and then draw a fan shadow at four rounded corners.
- /**
- * @author: Sunnybaby
- * @Title: Createshadowbitmap
- * @Description: Generate shaded picture
- * @param orignalbitmap: Original
- * @param shadowmargin: Shadow Edge width
- * @param Iconcornerradius: Original fillet radius
- * @return: Generated shaded picture
- */
- public static Bitmap Createshadowbitmap (Bitmap orignalbitmap,
- int shadowmargin, int iconcornerradius) {
- int w = orignalbitmap.getwidth ();
- int h = orignalbitmap.getheight ();
- Bitmap Shadowbitmap = bitmap.createbitmap (w + shadowmargin * 2, H
- + Shadowmargin * 2, config.argb_8888);
- int width = shadowbitmap.getwidth ();
- int height = shadowbitmap.getheight ();
- Canvas canvas = new Canvas (SHADOWBITMAP);
- Canvas.drawbitmap (Orignalbitmap, Shadowmargin, shadowmargin, null);
- Paint paint = new paint ();
- Paint.setxfermode (new Porterduffxfermode (Mode.dst_over));
- int radius = shadowmargin + Iconcornerradius;
- //four Edge shadow effect with linear shading, width equal to shadow margin + fillet radius
- LinearGradient leftgradient = new LinearGradient (radius, 0, 0, 0,
- 0x7f000000, 0x00000000, Tilemode.clamp);
- LinearGradient rightgradient = new LinearGradient (Width-radius, 0,
- width, 0, 0x7f000000, 0x00000000, Tilemode.clamp);
- LinearGradient topgradient = new LinearGradient (0, radius, 0, 0,
- 0x7f000000, 0x00000000, Tilemode.clamp);
- LinearGradient bottomgradient = new LinearGradient (0, Height-radius,
- 0, height, 0x7f000000, 0x00000000, Tilemode.clamp);
- Paint.setshader (leftgradient);
- Canvas.drawrect (0, radius, radius, Height-radius, paint);
- Paint.setshader (rightgradient);
- Canvas.drawrect (Width-radius, radius, width, Height-radius, paint);
- Paint.setshader (topgradient);
- Canvas.drawrect (RADIUS, 0, Width-radius, radius, paint);
- Paint.setshader (bottomgradient);
- Canvas.drawrect (RADIUS, Height-radius, Width-radius, height, paint);
- //Four-corner shadow effect with circular shading, radius equal to shadow margin + fillet radius
- Radialgradient topleftcornergradient = new Radialgradient (RADIUS,
- Radius, radius, 0x7f000000, 0x00000000, Tilemode.clamp);
- Radialgradient toprightcornergradient = new Radialgradient (width
- -Radius, radius, radius, 0x7f000000, 0x00000000,
- Tilemode.clamp);
- Radialgradient bottomleftcornergradient = new Radialgradient (RADIUS,
- Height-radius, Radius, 0x7f000000, 0x00000000, Tilemode.clamp);
- Radialgradient bottomrightcornergradient = new Radialgradient (width
- -Radius, Height-radius, radius, 0x7f000000, 0x00000000,
- Tilemode.clamp);
- //Draw four corner, is to draw four circle center angle is 90 degrees of the fan, DrawArc function The first parameter is the circular circle of the external rectangle, the second parameter is the starting angle, the third parameter is a sector clockwise glide angle, the fourth parameter if True, Include the center of the circle when the arc is drawn (to draw a fan), and the fifth parameter is a brush
- Paint.setshader (topleftcornergradient);
- Canvas.drawarc (new RECTF (0, 0, Radius * 2, RADIUS * 2),
- Paint);
- Paint.setshader (toprightcornergradient);
- Canvas.drawarc (new RECTF (Width-radius * 2, 0, Width, radius * 2),
- (+ ), N, true, paint);
- Paint.setshader (bottomleftcornergradient);
- Canvas.drawarc (new RECTF (0, Height-radius * 2, RADIUS * 2, height),
- (A );
- Paint.setshader (bottomrightcornergradient);
- Canvas.drawarc (new RECTF (Width-radius * 2, Height-radius * 2,
- width, height), 0, N, true, paint);
- return shadowbitmap;
- }
Read the notes after some experience sharing on the first development of Android TV set (STB)