about The Android Arsenal: Gradle Plugins

will cowl the most recent and most present data practically the world. manner in slowly therefore you perceive with ease and appropriately. will enlargement your information cleverly and reliably

It helps a number of display screen sizes simply by scaling its dimensions.

How does Xdimen work?

When you have got a UI design with a selected dimension and it’s essential assist completely different cell or pill gadgets in portrait or panorama mode. This case xdimension can assist you generate scalable dimensions for widespread gadget display screen sizes.

Xdimen generates an alternate res listing for every widespread (configurable) display screen width and scales the scale of your format.

The xml assets are generated with the assistance of kotlin xml constructor

Extra details about Xdimen here

Use

add to mission

Xdimen have to be utilized in an Android mission.

marvelous
  plugins 
    id 'io.github.islamkhsh.xdimen' model "$latest_version"   
    // agp plugin
   
kotlin
  plugins                          
    id("io.github.islamkhsh.xdimen") model "$latest_version"  
    // agp plugin
  

Configure Xdimen

All properties are elective, simply designWidth is required. The properties are mentioned in additional element within the subsequent part.

marvelous
  xdimen 
    deleteOldXdimen = true
    designWidth = 411 // required
    designDpi = mdpi()
    targetDevicesWidth = [360, 375, 411]
    dimensRange 
        minDimen = -10
        maxDimen = 600
        step = 0.5d
    
    fontsRange 
        minDimen = 10
        maxDimen = 60
        step = 1.0d
    
kotlin
  xdimen 
    deleteOldXdimen.set(true)
    designWidth.set(411) // required
    designDpi.set(mdpi())
    targetDevicesWidth.set(phonePortrait)
    dimensRange 
        minDimen.set(-10)
        maxDimen.set(500)
        step.set(0.5)
    
    fontsRange 
        minDimen.set(10)
        maxDimen.set(60)
        step.set(1.0)
    

Use scaled dimensions

After producing xdimen assets (see the subsequent part), you should use the scale

   <TextView android:layout_width="@dimen/x100dp"    # width in design is 100dp
             android:layout_height="@dimen/x50_5dp"  # top in design is 50.5dp
             android:padding="@dimen/neg_x6_5dp"     # padding in design is -6.5dp
             android:textSize="@dimen/x12sp"         # textSize in design is 12sp
             />

Chores

To run a activity be sure you run it in an Android mission utilizing one in every of these methods

  • $ gradle :prjectName:taskName.
  • From the gradle software window beneath android group.
  • Of Run AnyThing window.

generateXdimen

Generate alternate assets for every gadget width in targetDevicesWidth units and for every useful resource qualifier created, scales the scale to suit this width. It makes use of configured properties to calculate a scale issue, get the vary of dimensions to output, and the checklist of display screen widths to focus on.

deleteXdimen

Delete the beforehand generated xdimen assets except you have got renamed the res or dir file. will run earlier than generateXdimen should you set deleteOldXdimen property for true.

configuration properties

deleteOldXdimen

Setting it whenever you run generateXdimen homework deleteXdimen can be executed first to take away all beforehand generated xdimen assets and their directories if the listing incorporates solely xdimen.xml proceedings.

If you happen to modified the identify of the xdimen.xml file or its listing for any cause, this file won’t be deleted.

Default worth: TRUE.

design width

The display screen width worth of your format in dp Unit. can be used with designDpi to calculate the relative width of the sample (width relative to the primary density mdpi) after which calculate a scale issue for every display screen width in targetDevicesWidth.

In case your design is in px set its width to this property and set designDpi to be mdpi as in mdpi 1px = 1dp.

No default as a result of it’s required and have to be configured.

designdpi

Design display screen density (dots per inch) see more. This can be used with designWidth to calculate the relative format width.

The default is: mdpi

Predefined densities: for every density in common densities there’s a technique along with your identify ( ldpi(), mdpi(), hdpi()… and many others), there may be additionally a technique to set a customized density dpi(worth).

targetDevicesWidth

The width of the screens of the gadgets you might be focusing on. For every width on this checklist, an alternate useful resource with scaled dimensions can be generated.

ex: if the checklist is [350, 400] after

...
-> values/xdimen.xml            # Gadgets with screen-width lower than 350dp.
-> values-w350dp/xdimen.xml     # 350dp <= screen-width < 400dp
-> values-w400dp/xdimen.xml     # screen-width >= 400dp
...

You should utilize a predefined set as is, add or take away it, or present your personal set.

The default is: [designWidth] set of equipped worth designWidth.

Predefined units for widespread gadgets:

  • phonePortrait: common telephones in portrait orientation.
  • phoneLandscape: Widespread telephones in panorama orientation.
  • tabletPortrait: Widespread tablets in portrait orientation.
  • tabletLandscape: Widespread tablets in panorama orientation.

  • devicesInPortrait– Widespread telephones and tablets in portrait format.
  • devicesInLandscape: widespread telephones and tablets in panorama.

You possibly can mix a number of gadget lists, however I like to recommend that you do not goal each vertical and horizontal place, except you present a customized format for the horizontal place or use panel layout.

These lists have been collected from many sources: Wikipedia, Screen size, pixensity and others.

vary of dimensions

The vary of dimensions that you simply wish to generate and scale.

  • minDimen: the minimal dimension to generate.
  • maxDimen: the utmost dimension to generate.
  • step: the step between two generated dimen.

Default worth: minDimension=-10, maxDimen=600, step=1.00.

vary of sources

the identical of dimensRange however for the vary of dimensions of the fonts.

Default worth: minDimension=6, maxDimen=48, step=1.00.

screenshots

I hope the article roughly The Android Arsenal: Gradle Plugins

provides acuteness to you and is beneficial for including as much as your information

The Android Arsenal: Gradle Plugins

By admin

x
THE FUTURE - BENEFIT NEWS - DANA TECH - RALPH TECH - Tech News - BRING THE TECH - Tech Updates - News Update Viral - THE TRUTH - WORLD TODAY - WORLD UPDATES - NEWS UPDATES - NEWS FLASH - TRUTH NEWS - RANK NEWS - PREMIUM NEWS - FORUM NEWS - PROJECT NEWS - POST NEWS - WORLD NEWS - SPORT NEWS - INDICATOR NEWS - NEWS ROOM - HEADLINE NEWS - NEWS PLAZA