Android free root compatible with all version UI debugging Tools

Source: Internet
Author: User
Tags root access

What is Swissarmyknife?

Swissarmyknife is a convenient tool for debugging the Android UI, compatible with all Android versions and does not require root access. You can display the boundaries of all the controls in the current activity (whether or not hidden), the size of the padding, the size of each control, the size of the picture, the font color, the size, and the custom information, directly on the Android phone screen. At the same time can be directly on the screen color, but also provides a ruler (in pixels and DP), Circle Square (unit DP) tool, you can directly measure the size. For Android developers, there is also a layout tree view that allows you to view all the control hierarchy information in your current activity directly on your phone screen.

You can scroll through the level wheel to control the display of information at a certain level, avoiding layer overrides, and so on.

How to use

compile ‘com.wanjian:sak:0.0.2‘

Android 4.0 and above are called directly in application's OnCreate com.wanjian.sak.LayoutManager.init(Application context) , and other versions can onResume invoke initialization in the activity com.wanjian.sak.LayoutManager.init(Activity act) .

When you start the app, you'll see an Android logo in the upper-left corner of the screen and click to enter the feature screen.

Functional interface

Border options

When the border option is on, you can see the bounds of all the controls on your phone screen as follows

internal and external margin options

When turned on the screen will see the following effect

The translucent green represents the padding, the PT represents the top padding (padding top), the PL represents the left inner margin (padding), the PT represents the right padding (padding), and PB is the bottom padding (padding bottom).

The translucent red represents the margin, ml,mt,mr,mb the left margin, the top margin, the right margin, and the bottom margin, respectively.

All margin units are DP (PT), which is rounded up in Android and all margins are integers, so there may be no more than 1DP (PT) errors in the design.

Wide-Height options

When turned on, you see the width of the control, in DP (PT)

Picture Width High

Font size

Font Color

16 Binary, ARGB

Force picture Width Height

If you don't see the size of the picture when you turn on the image width option, you can try turning on the Force picture width option. PS This option may cause slippage

Custom Information

Custom information for Android developer debugging use, developers can set the view setTag(com.wanjian.sak.CanvasManager.INFO_KEY,Object) , after setting and turn on the custom information option, you can see the custom text information in the upper left corner of the control.

For example, the developer wants to see how many words are in the TextView on the screen, so it can be used so that textview.setTag(com.wanjian.sak.CanvasManager.INFO_KEY,textview.getText().length()) when the custom info option is turned on, you can see the text length on the TextView.

Real-time Refresh

When you turn on real-time refresh, you can see the information in real-time when you move your finger on the screen, and it may cause sliding lag when you turn on real-time refresh, or it may cause touch, click, etc. to fail.

Hierarchy information

You can scroll the wheel to control the display of only a certain level of information, such as just want to see the size of the ListView neutron control, you can scroll the wheel to control the size of only the ListView child control, how much to adjust the number of times you need to try. Scroll wheel can control border, width height, layout tree and so on.

Ruler round squares, color picker

Open will be displayed in the upper left corner of the screen, when the color picker just opened in the upper left corner of the screen to see a black box, drag to the location of the color to be lifted up the phone to complete the color, four corner of the color picker can get the value of the indicated pixel. The color picker can get each pixel color of the native page, or it can get the colors of each pixel in the webview.

Layout tree

The layout tree can be scaled with two fingers

Extended

Users can easily extend the SAK, simply inherit from AbsCanvas and re onDraw(Canvas canvas, Paint paint, ViewGroup viewGroup, int startLayer, int endLayer) -

or inherit from CanvasLayerAdapter and rewritedrawLayer(Canvas canvas, Paint paint, View view)

or Inherit fromCanvasLayerTxtAdapter

The difference is that the hierarchy is not processed in the OnDraw, and the view in Drawlayer provides a way to view,canvaslayertxtadapter the hierarchy drawTxt(String txt, Canvas canvas, Paint paint, View view) You can directly invoke Drawtxt to draw txt to the top left corner of the current view.

After you finish writing your custom canvas, you also need to add layout code to the Operatorview layout to open the custom canvas, such as adding a switch button to the layout, adding a listener to the button, and then invokingCanvasManager.getInstance(getContext()).addCanvas(new 你的Canvas())

For example, I want to customize a view of the TextView font size, I can first implement a canvas

PublicClassTextsizecanvasExtendsCanvaslayertxtadapter {@OverrideProtectedvoiddrawlayer (canvas canvas, Paint Span class= "Pl-v" >paint, view view) {if (View instanceof textview) {float size = ((textview) View" .gettextsize (); string txt = px2sp (View.getcontext (), size) + " sp/ "+ PX2DP (View.getcontext (), size) +  DP  

The switch is then added to the Operatorview layout and executed when it is opened

Canvasmanager. getinstance (GetContext ()). AddCanvas (Textsizecanvas ());  

You can do it.

Project Code:

Https://github.com/android-notes/SwissArmyKnife

Android free root compatible with all version UI debugging Tools

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.