layout-small not being recognized/not working - java

I made a layout-small xml file to fit smaller screen sizes for my activity. I was told that if you create a folder, named layout-small(with the XML inside it, of course) inside the res folder, android would recognize that the phones screen size is small and would automatically use the layout-small XML file.
I used the 3.2" HVGA Slider AVD to test the program, but it still used the normal layout. I hope this make sense, as I couldn't find another question similar to this.
If you need any additonal information or have any questions, let me know.
Thanks.

According to this page your AVD device has a screen size of "normal", so you will not pick up the definition for "small".
Device Definitions
The platform includes the following device definitions for use in creating Android Virtual Devices in the AVD Manager:
...
• 3.2" HVGA slider ADP1 (320 x 480, Normal mdpi screen)
If you want to target your AVD with a different layout, take a look at ways to specify an alternative.

Related

CodenameOne - Importing set of images in the theme

My CodenameOne app is mainly intended to be the iOS counterpart of an existing Android app. It is for older devices, in fact, as soon as possible, or in the future, a Swift app is going to replace it for OS 14>.
I need some customised icons and I have the svg code for it.
Initially I had to use the Flamingo tool, that converts svg files in Java classes.
I used it like
ScaleImageButton appButton=new ScaleImageButton(new AppIcon().scaled(doubleButtonSize,doubleButtonSize).toImage());
It is cumbersome but it does not even work on iOS.
So now I resorted to create png images for every icon in every dpi level, as it can also be done on Android.
I renamed the files so they follow the standard I think it is proposed in CodenameOne.
The possible names are:
verylow.png
low.png
medium.png
high.png
veryhigh.png
560.png
hd.png
2hd.png
4k.png
In the end it has to be used like
Image icon = theme.getImage("icon.png");
It seems that the images can be imported in the project in more than one way.
I was said to include them in the theme.
According to the CN1 developer guide I have to set the size for each.
If I import them as a whole (selecting the folder or selecting all images and hitting the "Open" button) in the theme editor a dialog appears with all wrong sizes (but they resemble a particular set of choice, although very unlikely).
They are not always the same sizes but neither they are defaulted according to the provided set of images.
I provide images as 24px, 36px, 48px, 72px, 96px, 144px, 192px, 288px, 384px for normal size icons, and also I provide double sized images for double size icons in my app (the values are not doubled as expected).
I also have to check "Square image" and "Preserve aspect ratio" options (my images are already square).
Then the strangest part is that there is a percentage, I see it is 20 for example.
The caption reads "will affect all entries". I understood that it is to scale images, that is what a developer just do not want, unless the developer has wrong sizes, but still proportioned among themselves, that cannot be the case I think.
However I do not need any scaling, the images are right as they are. I created them on purpose.
The developer guide is not enough clear to me.
So I am asking
is it right to tweak the wrong size to match the right ones, and what about the percentage?
This specific UI is a bit out of date by now and wasn't used much even when it was added. Most users opted to do desktop scaling for multi images.
The scale option is designed to scale down from a high resolution image on the desktop. You don't want/need that.
You don't need to edit the file. Just make sure to turn on the XML team mode and make sure your images use the right file names. Then once you save the images will appear in the resource file.
I suggest adding a multi-image using the standard method of add in the menu. Then replacing all the generated images with your copies and reopening the file, then saving again (the last save is important as it will override the res file).

xml editing (CandyBar dashboard for icon pack)

I have been working on some icon packs for months & will be completed within a few days and I came across CandyBar dashboard.
I'm new learner for android and java. Still studying java & So not enough knowledge of programming but I read the tutorial on CandyBar's wiki page and understood about I guess 80%.
I understood how to configure that app according to my needs.
but I'm little bit confused regarding certain xml files.Tutorial didn't clearly explained which xml needs to be edited & which to be ignored & how to be edited to make my icons pasted in drawable folders to work on different launchers.
From this xda tutorial I understood, three xmls:-
/res/xml/drawable.xml ...........to make icon appear on app to let user select icons
/res/xml/appfilter.xml..................need to add activities in it of various apps
/res/values/iconpack.xml _________(Not available in CandyBar)...... why ?
so by editing 1 & 2 xml I'm able to make my icon pack work on nova launcher and few similar launchers but not on "go launcher", so I'm confused if I'm doing something wrong.
Same xml which are in assets folder too ! :( should I edit them ?
Just want some clarification regarding xmls anybody used it ? or know about it ?
all xml files picture
You can create your icons, right click and right click> New Asset Vector at the top Type of resource: vocaloisa two options Clip Art and Local File (SVG, PSD) by clicking the clip art icon You can do download your own computer with SVG or PSD in case you want a standard that android requires.
You can also import a PNG vector directly into the drawable mass if you can not generate the SVG or PSG, as it is a graph of one and not an image that needs several dimensions you can choose to import only 1 size and work in your By while the default is already 24dp x 24, but when the default is already being erased, 24dp x 24, when you have some impression at some point of view you leave these dimensions, but it is recommended to use the Android icons or whatever you want stay in a more elegant standard. so the icons come in xml and you can edit them if you know how to mechanize with pure xml

Why my font in design viewer is blurry in Android Studio?

Why my text inside the android design viewer appears blurry. I tried changing the resolution DPI setting as well. But it didn't work for me.
Please look at my second picture, to let you know which one is I am talking about.
Try changing the scaling to 100% instead to 125%. Normally in Windows 10 default scale in 125% recommended. But using 100% will fix this.
To Find Scaling Setting:
Right Click on the desktop
Navigate to Display Setting
Dont Forget to go advanced scaling setting
And
Turn on the Fixed Scaling for the apps
Just incase sometimes
Before:
After:
How about changing device settings?
It just change the resolution of example device and it would make more clear sight from design view. It doesn't change the layout codes.
It would help the development with clear visual, but you have to test various resolutions of devices if you needed to.
Go to 'Help' tab and click on 'Edit Custom Properties'. It might ask you to generate a file if it doesn't already exist. Once this properties file was made, I wrote 'hidpi=false' (no quotations) on a new line, saved it, and restarted Android Studio.

How to design UI for android application that will compatible for all devices?

I am developing android applications from last four months, but still i am not able to design UI which will support for maximum screens. What should be my ideal layout and drawable structure and what is the good way should i follow to achieve it. Please help me.
Thanks in advance.
Well the best way to do that will be:
the same icon with different sizes and put them in order in the(these are order from smaller sizes to bigger sizes):
mdpi
ldpi
hdpi
xhdpi
Th OS will automatically get you the best icon to fit the screen.
Obviously if you want to run your apps in tablets as well it will be extremely hard to achieve a layout that can be compatible with thousands of devices available on the market.
For that you can create different layout folders and create several of them for different screen sizes.
For more info you should definitely see this dev page:
http://developer.android.com/guide/practices/screens_support.html
Hope this helps
Use RelativeLayout or LinearLayout with weights. So that you get same view on most on screens. You can use one copy of images with good resolution in drawable folder that can adjust on most screens or different sizes images in different drawable folders but its increase your app size. But its always good practise to create layout depend on different sizes and some layouts based on height and width.
I'll quote the top answer of this thread which is pretty much equal to your question.
That may not be possible. However you can look at these links and
learn how to provide different images(pixels and density), layouts and
further on. It may not be possible to make a userinterface on a low
level density screen the same way as a high density screen and then
you can target different layouts to different phones e.g.
Providing Resources
Application Resources
You should also have a look at this: Best practice supporting multiple screens.
Although it is possible you should focus on a few main densities/screen sizes which you will support. Test these and make sure they work as you want them to do. It will be very much work to support all varieties and may not pay off because only few phones use specific sizes.
Best way to implement Fragment
And also use import any icon with the following steps
Right click on Project
select ->new -> other..
Then choose Android Icon Set
Launcher Icons, Icon Name
so on...
You can follow this tutorial http://www.vogella.com/tutorials/AndroidFragments/article.html

Screen optimization for tablets

I have optimized my app for just about all Android phones. The way my app is set up, I have a 16dp padding on the left and right side of it and a 65dp padding on top and bottom (see screenshot below). On a phone it looks beautiful.
But on a tablet, it looks terrible. 65dp on a phone is a whole lot different that 65dp on a tablet. On a tablet, the black border around the question runs off the side of the scroll background and stuff is on the roll at the top and bottom of the scroll background.
What are my options to fix this? Is there a percentage/weight option for padding? I think that would solve it completely but there is nothing like that that I know of.
You can create multiple resource files tailored for different display sizes. Android will automatically choose the correct resource file for you. Using this technique, you can specify padding values for any screen size, or even completely unique layouts, to be automatically selected for you by Android.
Please refer to Designing for Multiple Screens.
Using multiple dimension resource files would make the task of changing the padding based on screen size very simple. See More Resource Types.

Categories

Resources