Feed Buzzard
  • General
  • Tech
  • World Tech
  • World Tech Code
  • Wearable Tech
  • Pokemon
  • About Us
    • Terms & Conditions
    • Privacy Policy
  • Contact
No Result
View All Result
  • General
  • Tech
  • World Tech
  • World Tech Code
  • Wearable Tech
  • Pokemon
  • About Us
    • Terms & Conditions
    • Privacy Policy
  • Contact
No Result
View All Result
Feed Buzzard
No Result
View All Result
Home World Tech

Different resolution support android –

Gordon James by Gordon James
December 19, 2020
in World Tech
0
0
SHARES
0
VIEWS
Share on FacebookShare on Twitter

Development issue/problem:

Edited question:

Moving resolution : I would like to develop different screen dpi’s, like the following resolutions.
320×480,480×800,540×960,720×1280 (Samsung S3),1080×1920 (S4, Nexus5,Nexus 5x, Motorcycle G4),2560×1440 (Nexus 6, Nexus 6p, Samsung Edge) Tablet resolution
: 480×800 (Micromax),600×1024 (Samsung tab2),800×1280 (Nexus 7),1200×1920 (New Nexus 7),2048×1536 (Nexus 9).

I want to use different font sizes depending on the screen resolution of the device.

Q1) What is the best way to solve this problem?

Q2) What is the best option – drop encoding or XML?

Q3) In which folder is the resolution of the device displayed?

Q4) What is the size of the application launch icon for different resolutions?

How can I solve this problem?

Solution 1:

Application thrower icon size in pixels for different resolutions

Moving resolution

  • mipmap-mdpi (48X48)
  • mipmap-hdpi (72X72)
  • Mip Card Exhaust Pipe (96X96)
  • mip-xxhdpi card (144X144)
  • mip-xxxhdpi card (192X192)

Shelf arrangement:

Use the following folders if you want a specific layout for your tablet:

(1024×600)(800×1280)(1200×1920)(128 00)(2560×1600)

Drawing folders:

  1. Mobile

red/signettable (standard) red/signable dpi/ (240×320 and above) red/signable dpi/ (320×480 and above) red/signable ddpi/ (48 00, 54 60 and above) red/signable ddpi/ (720×1280 – Samsung S3, Micromax HD Canvas etc.) red/signable ddpi/ (48 00, 54 60 and above) red/signable ddpi/ (720×1280 – Samsung S3, Micromax HD Canvas etc.(1080×1920 – Samsung S4, HTC one, Nexus 5 etc.)res/signable-xxhdpi/(1440X2560 – Nexus 5 etc.).etc.). res/ removable-xxhdpi/ (1080×1920 – Samsung S4, HTC one, Nexus 5 etc.)res/ removable-xxhdpi/ (1440X2560 – Nexus 6,Samsung S6edge).

  1. Tablet resolution :
    Fill in the image description here

Font size:

NOTE: Always try to use SP when working with textSize, for example. B. textize=12sp

  1. Use the predefined textImage :

It automatically adjusts the text size to the density of the device.

Use of samples :

  1. Use dimension.xml for each device:

From the Google IO Pdf you can see the structure below:

    1. Mobile:

res/values/dimens.xml (standard)res/values-ldpi/dimens.xml (240×320 and higher resolution)res/values-mdpi/dimens.xml (320×480 and higher resolution)res/values-hdpi/dimens.xml.xml (48 00, 54 60 and higher resolution)res/values-xxhdpi/dimens.xml (720×1280 – Samsung S3, Micromax Canvas HD, etc.)res/values-xxhdpi/dimens.xml (1080×1920 – Samsung S4, HTC one, etc.)

res/value-xxxhdpi/dimens.xml (1440X2560 – Nexus 6,Samsung S6edge).

    1. Tablet:

For the tablet, more specific folders can be used, such as large, valuable folders.

res/values-large/dimens.xml (48 00)res/values-large-mdpi/dimens.xml (600×1024)

or

res/values-sw600dp/dimens.xml (600×1024)
res/values-sw720dp/dimens.xml (800×1280)
res/values-xlarge-xhdpi/dimens.xml (2560×1600 – Nexus 10)
res/values-large-xhdpi/dimens.xml (1200×1920 – Nexus 7(last))

For more information :

See Supporting multiple screens.
For more information on device density, see the Google IO pdf on page 77. Here you will find a way to work with dimens.xml for different devices.
Prepare your Nexus 6 and Nexus 9 applications.

Extract of the multiscreen support:

A density independent pixel corresponds to a physical pixel on a
screen at 160 dpi, which is the basic density assumed by the
system for a medium density screen. During operation, the
system transparently handles any necessary scaling of the dp units based on the current
screen density. The conversion of dp units to
screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi
screen, 1 dp corresponds to 1.5 physical pixels. When defining the user interface for your application, you should always use dp
devices to ensure that your
user interface is displayed correctly at different screen densities.

Solution 2:

First create folders with different values for the different screens.and place the size corresponding to screen
in the file res->values->dimens.xml and call the single font size with @dimen/text_size.

res/values-normal/dimen.xmlres/values-normal/dimen.xmlres/values-large/dimen.xml

// for the little ones

15sp

// for a normal life

20sp

//in general

30sp

// on a large scale

40sp

and restore the font size in TextView as follows.

Solution 3:

To avoid problems with different screen resolutions and densities, I place and position everything according to the width and height of the screen as a percentage. By adjusting the text to the percentage of the screen width or height, the font will have the correct size on all devices and in all resolutions. To get the correct font size for the width and height of the room, you can use this function:

private float SetTextSize(String text, int width, int height)
{
paint paint = new Paint();
float textWidth = paint.measureText(text);
float textSize = (int) ((width / textWidth) * paint.getTextSize());
paint.setTextSize(textSize) ;

textWidth = paint.measureText(text) ;
textSize = (int) ((width / textWidth) * paint.getTextSize() ) ;

// Measure again with the font size next to our desired result
paint.setTextSize(textSize) ;

// check height restrictions
FontMetricsInt metrics = paint.getFontMetricsInt();
floattextHeight = metrics.descent – metrics.ascent;
as (textHeight > height)
{
textSize = (int) (textSize * (height/textHeight));
paint.setTextSize(textSize);
}
return textSize;
}

Here is the code to determine the width and height of the screen:

as (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2)
{
Point Size = new Point();
getWindowManager().getDefaultDisplay().getSize(size);
screenWidth = size.x ;
screenHeight = size.y ;
}
else
{
display display = getWindowManager().getDefaultDisplay() ;
screenWidth = display.getWidth() ;
screenHeight = display.getHeight() ;
}

To get the correct font size, simply create a range based on the width and height of the screen and adjust it until the font size seems correct. Once you’ve done it right, it should be clearly visible on all devices.

float textSize = SetTextSize (text, (int) (screenWidth * 0.1), (int) (screenHeight * 0.15)) ;

I hope this helps you

Solution 4:

Basically, you have to create a text style, something like this:

More information can be found here at http://developer.android.com/guide/topics/ui/themes.html.

And by using the Android guide to support different screens, you can create different formats for different screens in the appropriate folder, as described at http://developer.android.com/guide/practices/screens_support.html.

Accompanying note : I’m not sure I know what situation you’d want to do it in. By using SP units for font size, fonts can be scaled to approximately the same size on different phones.

Solution No 5:

First, the draft of your resolution request.

For example: Assuming the resolution of your mobile phone is 380*480.

Width of the mobile phone screen : 380

Text Image size 80dp
Assumption: If the width is 380dp, then 100%.

the display width of the text is 80dp, how much %(per) is there then.

The answer to the question: The answer to the question: The answer to the question: The answer to the question: The answer to the question: Reply: 25 %

determine the screen size programmatically with the pigeon formula

DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
ScreenHeight = displaymetrics.heightPixels;
ScreenWidth = displaymetrics.widthPixels;
txt_height = (int)((ScreenHeight*14.58)/100);
txt_width = (int)((ScreenWidth*37.5)/100) ;

LinearLayout.LayoutParams normal_param = new LinearLayout.LayoutParams(txt_height,txt_width ) ;

txt_Name.setLayoutParams(normal_param) ;

Solution No 6:

I think that’s a good answer:

Text size and different Android screen sizes

But here’s how you do it with the screen resolution:

You can create a resource value directory for each permit as follows

values-WWIDTHp-HIGHTdp (you can also use WWIDTHp or values-HIGHTdp)
, for example: 320*480 becomes values-w320p-h480dp

Create in each folder (including the default values folder) a file named dimens.xml with the contents :

z. B. (resolution related value):
10sp

You can now use @dimen/def_font_size
or create a style in the default values folder.

Add this to the styles.xml file:

Solution No 7:

I’ve created a function that adjusts the size of the dp to the size of the screen, and it works well for me. If you have problems with the size of the text on the screen, try this.

public float convertFromDp(int input) {
final float scale = getResources().getDisplayMetrics().density;
return ((input – 0,5f) / scale);
}.

is simply by assigning the defined value to the size of the text display, as shown below.

tvTextView1.setTextSize(convertFromDp(24)) ;

Solution No 8:

To support nexus 6, create a 560 dpi rendering folder and place all images in it.

Good luck!

Related Tags:

recover deleted files from htc phone,how to recover deleted videos from htc desire,android recovery-transfer,android android data recovery,www android recovery net android data recovery html download,android phone soft android data recovery,data recovery android,recycle bin in htc desire

Total
0
Shares
Share 0
Tweet 0
Pin it 0
Share 0
Gordon James

Gordon James

James Gordon is a content manager for the website Feedbuzzard. He loves spending time in nature, and his favorite pastime is watching dogs play. He also enjoys watching sunsets, as the colors are always so soothing to him. James loves learning about new technology, and he is excited to be working on a website that covers this topic.

Related Posts

Tech

Strategies To Market Your E-Commerce Business

February 10, 2023
Blockchain Conference in Poland Showcases New Solutions to Problems in Enterprise Logistics
World Tech

Blockchain Conference in Poland Showcases New Solutions to Problems in Enterprise Logistics

December 15, 2022
World Tech

Rockstar Games Brings GTA to The Metaverse

October 20, 2022
Next Post

Roblox Promo Codes (Jan to Dec 2021) – Free items

13 Best Puzzle Games For Android To Play On Your Smartphone

How To Unblur An image [7 Method]

No Result
View All Result

Recommended

indiabased arya south asia 46m series 14msinghtechcrunch

How will this boost financial inclusion for India’s farmers?

11 hours ago
indiabased arya 46m 14msinghtechcrunch

What are the benefits of using Arya?

11 hours ago
indiabased arya south 46m series 14msinghtechcrunch

How Arya is helping farmers access finance and post-harvest services

11 hours ago
n26 900m 9b 7mdillettechcrunch

The future of banking with N26

11 hours ago

Categories

  • Fitness Trackers
  • General
  • Latest
  • Pokemon
  • Tech
  • Technology and Computing
  • Wearable Tech
  • World Tech
  • World Tech Code

Recent Posts

  • How will this boost financial inclusion for India’s farmers? March 22, 2023
  • What are the benefits of using Arya? March 22, 2023
  • How Arya is helping farmers access finance and post-harvest services March 22, 2023
  • The future of banking with N26 March 22, 2023

Categories

  • Fitness Trackers
  • General
  • Latest
  • Pokemon
  • Tech
  • Technology and Computing
  • Wearable Tech
  • World Tech
  • World Tech Code

© 2022 FeedBuzzard.com

No Result
View All Result
  • General
  • Tech
  • World Tech
  • World Tech Code
  • Wearable Tech
  • Pokemon
  • About Us
    • Terms & Conditions
    • Privacy Policy
  • Contact

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT