So i have the following files in these directories:
res/drawable-hdpi/icon_logo.png
res/drawable-xhdpi/icon_logo.png
In my XHDPI layout res/layout-xlarge/main.xml I am referencing the icon_logo in an image however the HDPI resolution asset is displayed instead of the XHDPI asset.
<ImageView
android:layout_width="229.50dp"
android:layout_height="42.50dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="13dp"
android:contentDescription="#string/cd_header_text"
android:src="#drawable/icon_logo" />
Why would this be, I've been hitting my head against a wall for the last hour trying to figure this out.
p.s. the tablet I am testing with is a Galaxy Tab 10.1 Running HoneyComb 3.2
To my knowledge, a Galaxy Tab 10.1 has MDPI an screen the same as the Moto Xoom, so my guess is that if you don't have an MDPI icon the resource manager takes the next one available, which is the HDPI icon?
xhdpi refers to the density whereas xlarge refers to the screen size.
Galaxy Tab 10.1 has a density of 149 ppi and a screen resolution of 1280x800.
You could check Supporting Multiple Screens for details about the qualifiers that you can use for your resources.
Related
I downloaded skin of galaxy A52 from official samsung website: https://developer.samsung.com/galaxy-emulator-skin/galaxy-a.html.
Moved the file into the right directory, added the device: size 6.5 and resolution 1080x2400 and API is 31. I was following this tutorial: https://www.youtube.com/watch?v=6JIPsZpIJzE.
My question is: I have those corners and a camera too small, how do I resize them to fit naturally?
To change that you need to locate to the "Device frame skin definition" folder that you downloaded and pasted before. For me that was this folder:
C:\Program-Files\Android\Android Studio\plugins\android\resources\device-art-resources\Galaxy_A52
You should open "layout" file and see how different frames are set. In my situation I found that fore_port.png was at the forefront. I checked and it had dimensions 324x720. Dimensions of the screen are 1080x2400 so you should google "change dimensions of png" and change them. Then, replace the file. After this, restart android studio and everything works.
Now I have something that looks like this:
In appxmanifest file, there are five options for Splash screen : 620x300, 775x375, 930x450, 1240x600 and 2480x1200.
I have the following resolutions in my 15" laptop :
1366x768 (Recommended)
1360x768
1280x720
1280x600
1024x768
800x600
My question is, if I provide all five image in appxmanifest for Splash Screen, how those going to effect my laptop's different reolustion. I looked into MSDN blogs mentioning about some scale factor. I also noticed that, for each splash screen image, corresponds to a name like "SplashScreen.scale-100", "SplashScreen.scale-125", "SplashScreen.scale-150", "SplashScreen.scale-200" and "SplashScreen.scale-400"..
Actually it's a very beginning level question, but I am kind of puzzled up with all those
You have one minute video which explain Scaling and effective pixels in UWP apps. In addition, the Store picks the assets to download based in part of the DPI of the device. Only the assets that best match the device are downloaded. By the way, don't hesite to add a maximum of assets.
To help you, the following extension can generate the different size for you.
UWP Tile Generator Extension for Visual Studio
I have encountered a problem while adjusting UI for various devices on android.
I created res/values-hdpi folder and similar other folders to put the dimensions of the layout there and adjust app's UI. I tested it on two devices
1) HTC ONE S
2) Samsung GT i8262
Both the devices comes under normal hdpi category according to android developers site. But the layout is completely misaligned in samsung device. Is there a solution to this sort of problem. I have also checked by changing the dimensions in the values-hdpi folder to confirm that both devices pick from same resource and it does!!! Both pick the dimensions from values-hdpi folder but misaligned in one of them.
Note: Both devices have only hardware buttons no navigation bar. So need not worry about that.
My guess is that HTC ONE S is 256 ppi, samsung gt i8262 is 207 ppi, but both have 4.3" screens, is this the problem?? How do I solve this if this is the case?
I finally created two values folders values-sw360dp-hdpi for HTC 1S and values-sw320dp-hdpi for Samsung GT i8262 and it worked.
I know this is going to sound ranty, but it just feels like Android's UI components and behaviours are off the wall sometimes.
Consider the following XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<RatingBar
android:id="#+id/ratingBar1"
android:style="#android:style/Widget.Holo.Light.RatingBar.Small"
android:progress="3"
android:max="5"
android:numStars = "5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Screenshots of how that would look on different device sizes:
Nexus S rating bar
Tablet rating bar
Small Device rating bar
Even though it's only in the preview tool, I can confirm that's actually how it looks on the devices.
The small device behaviour is maddening. How does a RatingBar that specifies 5 stars only get 3 displayed, why not scale down the stars to fit in the window?
Thinking the wrap_content width was the issue, I switched to layout_width="fill_parent" and that didn't change the look on a small device, but it completely messed up on Tablets (so much for "numStars" of 5):
My question is, is there a way to get proper behaviour for the RatingBar in terms of sizing? You would think the numStars or max would be sufficient but it's completely arbitrary. When the RatingBar is stretched so that it draws more stars, it adds stars and see how with a progress of 3, it draws it according to the number of stars displayed? It doesn't make sense not to adhere to numStars!
If there is no way to get logical performance from the RatingBar, are there any alternatives including 3rd party widgets? If not, I guess I could always draw 5 ImageViews and just rig it to perform accordingly.
(Keep in mind all this behaviour was exhibited with just one RatingBar in the layout - forget trying to size with other widgets/components, or utilizing your own styles. I know it's been done, but why is this the default behavior?)
I felt the same way as you when using the stock RatingBar, so I made my own: SimpleRatingBar.
It features:
Fully working android:layout_width: it can be set to wrap_content, match_parent or abritary dp.
Arbitrary number of stars.
Arbitrary step size.
Size of stars can be controlled exactly or by setting a maximum size.
Customizable colors (border, fill and background of stars).
Customizable size separation between stars.
Customizable border width of stars.
Allows to set OnRatingBarChangeListener
Stars fill can be set to start from left to right or from right to left (RTL language support).
AnimationBuilder integrated in the view to set rating programatically with animation.
Here is a preview of it.
You can find it either in jcenter or in Maven Central. So in your build.gradle file just add to your dependencies:
compile 'com.iarcuschin:simpleratingbar:0.1.+'
I hope it's useful.
I'm having trouble running my app on the Galaxy tab original 7". It appears to make everything 1.5 times bigger, i.e. if I specify 40dip for a textSize in my layout, it will display as 60 dip when I run it on the tablet.
I tried messing around with the display metrics and changing the density and densityDpi to 1. (When I run a toString of the display metrics in the Galaxy tab 2, they are both 1, whereas the Galaxy tab 1 has values of 1.5)
The app runs very well on every phone I've tested it on, and on the Galaxy tab 2, so I can't figure out what the problem is. I even tried creating a dummy app with just a textView with a size of 40dip, and it still converted it to 60.
Any ideas?
Does the answer to this question help you? Seems that he is having the same (or similar) problem.
Android layout on emulator vs device
Android, concerning the User Interface design