Last Updated: December 27, 2017

Tips & tricks android developer should know - part 4

Description: In this post I'm gonna show you some interesting tools from android studio we developers use.

Also check out Part 1,Part 2  and  Part 3.


So let's get started.


1. Layout Inspector: Layout Inspector is an interesting tool to help track view and their respective properties. It contains-

    •    View Tree - contains the hierarchy of the android widgets displaying the full nesting of views.
    •    Properties Table - contains the properties attached to respective view. e.g:layouts/methods/padding and many more.
 a) How to enable it?
        Goto Tools -> Android -> Layout Inspector fig.1 
     
fig.1 Layout Inspector
 Note: Make sure you have android process running for your app and you have active window present to take the screenshot.

 b) How to understand it?(fig.2)

    Left
       - 'View Tree' showing full hierarchy of the screen.
   Center
     - Screenshot of the active window       
   Right
      - 'Properties Table' for each view.
  View Click
    - Properties of the widgets get updated on the right pane i.e 'Properties Table.' and get high Lighted  on the screenshot screen.


fig.2 Layout Inspector

fig.3 Layout Inspector with Properties

RecyclerView:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    tools:context=".MainActivity">
    <android.support.v7.widget.RecyclerView
        android:id="@+id/percentList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />
</RelativeLayout>
RecyclerView Item:

<android.support.percent.PercentRelativeLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/fifty_huntv"
        android:background="#ff7acfff"
        android:text="20% - 50%"
        android:textColor="@android:color/white"
        style="@style/STYLE_PERCENT_TV"
        app:layout_heightPercent="20%"
        app:layout_widthPercent="50%" />
    <TextView
        android:layout_toRightOf="@id/fifty_huntv"
        android:background="#ffff5566"
        android:text="80%-50%"
        style="@style/STYLE_PERCENT_TV"
        app:layout_heightPercent="80%"
        app:layout_widthPercent="50%" />


</android.support.percent.PercentRelativeLayout>


Its an amazing tool to analyse the screen UI for the developers with all the information available on single click. Simply great.



2. How to change DPI of Phone using ADB?

Many times in our development phase we want to check the look of android UI on low/high end devices. Changing the DPI could come handy in such cases.

So let get started.

Steps 1: Find out your phones dpi using below command of adb shell. Search for 'mBaseDisplayInfo='. And then search for density within it.Save it for future to revert our dpi
adb shell dumpsys display

Steps 2: Search for 'mBaseDisplayInfo' and 'density' as show in fig.4


fig.4 Display Density
Step 3: Finally enter below adb command to change the dpi. (fig.5) with 200dpi,420dpi and 600dpi respectively

adb shell wm density 150



 


Note: If the changes do not reflect you can also try:
adb shell wm density 150 && adb reboot

Thats it, the screen will be reloaded and icons sizes will change to withstand with the density specified in the command.


For more updates follow us on -  
Twitter

15 comments :

  1. I think choosing a time to look for an apartment is less priority. From this post, I Know that we have to focus on the time to look for the new apartment.

    Flats for sale in Vadapalani
    Builders in Chennai
    Properties in Chennai

    ReplyDelete
  2. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. Thank you a lot! and if you need App development company then contact us!

    ReplyDelete
  3. I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. app cloner pro apk

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Besides, Google Play store also faces an enormous volume of guests for downloading different apps for various purposes. Hence, is a key explanation behind Android apps to have important reach than the different apps.
    https://appcloner.app
    https://appcloner.net

    ReplyDelete
  6. Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include. via app cloner

    ReplyDelete
  7. i never know the use of adobe shadow until i saw this post. thank you for this! this is very helpful. hoverwatch price

    ReplyDelete
  8. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work! watch face

    ReplyDelete
  9. Flutter Programming is one of the most popular in the cross platforms industry. We build excellent flutter mobile app and also learn how to overcome performance issues. is the best choice for all startups to discuss and get their project quotation. Flutter Development Company We also enable many startups to do Proof of concept and help them to learn about business decisions.

    ReplyDelete
  10. Thanks for sharing such a great information. Flutter framework is mostly used nowadays, as every business is building apps for both Android and iOS. It is the best known cross platform framework for app development in Austin.

    ReplyDelete
  11. Thanks for writing such a good article, I stumbled onto your blog and read a few post. I like your style of writing. Mobile Price in Bangladesh 2020

    ReplyDelete
  12. Smart Outsourcing Solutions is the leading web development, ecommerce solution, offshore outsourcing development and freelancing training company in Dhaka Bangladesh please
    visit us: seo service company in bangladesh
    seo service in bangladesh

    ReplyDelete

Your comments are valuable for us !!!