Is there a way to resize layouts with button click? - android

Hi I am developing an app for large screens (24 inch - 30 inch) and I need a way to make it easier for wheelchair users to use the app. The first idea I have is resize all activities to a percent (50%) and put layout to bottom left or right. But I dont know how it can be done and need help or a different solution for the problem.
What i want is with a button click resize activity layout to example below. orange color represents activity and black orange image is when activity size reduced to size.

You can set other xml which have difference size which make you can design your UI depend what type device user used. There four type size = small, normal, large, and extra large (CMIIW). You can use this for reference
Adapt layout to all screen resolution - Android
https://youtu.be/th9YQ8nmhNg

Related

Making activity_main-small is not working properly

I read that to support different screen sizes you have to make a new layout (with the same name) for the different screen sizes (small, large, xlarge, normal).
Im trying to start with the small one but for some reason whenever I create it, the preview gives me Wear Square screen (a squared screen) and I can't change it to a small screen (as shown in the picture)
What can be done for this to support a small screen sizes and a large ones?
Possibly you even do not have such small device to see your layout in action.
The one you select on screenshots is watches - they should apply another suffixes.
Like a alternative way - try to use percentage attributes in ContraintLayout and autoSize attributes for TextView.

put background with specific size and position

i'm working on an Android application and i'dd like to put a background image. my problem when i set the android:background is that the image is show on all the screen.
i'dd like to have my background on only 50 % height and wide.
thank you
This depends on screen size of devices. I recommend that You read about supporting multiple screen sizes:
http://developer.android.com/guide/practices/screens_support.html
You can also do this programmatically, but is a bad practise. To get the result You want, You have to set a layout.xml for every screen size. It is also recommended that You better put that image inside an imageView, because of a good scaling on different devices.

Custom Android screen size

I would like to know whether there is such possibility to customize the screen size on Android devices? Something like using half part of the screen and the other half is blank.
For this kind of problems, you can work with percentage. There are 2 common ways:
in java:
You can get the display height from your used lcd-panel and then multiply with your number of percents. In this way, you have to format the button in your activity.
in layout xml:
You should design your layout within the xml-files and not in java code (my oppinion). Use layout-weight like following post: set position size of ui element as percentage of screen size

Android one PNG screen image with EditTexts located on screen

I have a full screen png image with all descriptive text for each EditText. I want to place the six EditText input areas at the correct positions on the screen.
I understand the different layout folder names for different screen sizes, densities and orientations. So I would have different layout XML files for each.
My problem is how to place the EditTexts at the correct location, and have them scale what would be small amounts with the small variations of sizes as the full screen png image will scale.
I believe that I should not specify locations, even with density independent pixel (dp |dip), as they may not work in future versions.
I cannot find anything on searching for this problem. What I can think of is a Relative Layout with blank or transparent dummy TextViews pushing the EditTexts to the correct positions.
My reasons for doing it this way with one png image for all the non-EditText parts of the screen are (I think)
- Can get a nicer screen image
- Is more efficient to place one png ImageView on the screen
- Is how it was done in another mobile environment
Any thoughts or suggestions?
My recommendation is that you remove any text parts and other that needs to be aligned from the background image, then create a RelativeLayout where you can add these as real TextViews/EditTexts.
This will give you the best result and flexibility considering all the different screen sizes and resolutions available for Android phones and tablets.

Screen Size Resolution problem

I have Some Background image in to My Application. That background Image also contain the Button image. I am manualy create and set the Button on that Button image of the Background Image. now while the Screeen size changes for another device then the real button and the Button Image that show on the Background image shows different. How i can set it for the ProperView. Or if i want to make another Background Image that dont contain the Image of the Button. Then which Screen size should i have to prefer for different Device Competibility.
I have read this competibility documents. But not getting proper idea if i have to set the background image for all device then which screen size i have to prefer. So can any budy explain me in Short and Sweet ?
Thanks.
According to Supporting Multiple Screens, you have to create multiple layout folders!
For example: you can have 2 versions of my_layout.xml
res/layout-xlarge/my_layout.xml
res/layout-normal/my_layout.xml
Read Supporting Multiple Screens; There are lots of details there.
Read Supporting Multiple Screens; There are lots of details there.

Categories

Resources