how to run one mobile apps on multiple android phone? - android-layout

I was created simple currecnyConverter apps in android But I got Problem is that when i did run this apps Nexus S(4.0",480 * 800:hdpi) emulator in Protrait is working fine but same apps run on landscape mode my button and component not fit on the screen so I want run my apps on any mode and any android version.please
can anybody give me answer.
Thanking you

You have to go through the below page:
http://developer.android.com/guide/practices/screens_support.html
You have to design the layout for landscape mode in layout-land folder with same name as in your Portrait mode.
For more info see the above page.
Thanks.

You need to create different layout for landscape and portrait.
Follow this
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation
res/drawable-mdpi/my_icon.png // bitmap for medium density
res/drawable-hdpi/my_icon.png // bitmap for high density
res/drawable-xhdpi/my_icon.png // bitmap for extra high density

Related

Android Virtual Keyboard affect screen rotation ( Using Cocos Creator to build )

I using Cocos Creator 3.5.2 for this project.
When I start testing input text field in android phone either in app or web browser, after the virtual keyboard appear and I try rotate screen from landscape to portrait, the keyboard got change but the screen layout dint resize still is landscape but only smaller n at top.
It need to close the keyboard then the screen layout will start resize and this is in app.
Any idea that can cause this happen?
And any solution for it.

Designing for full screen

Summary: I'm having a big problem with layout design in my project... I want to set it up in fullscreen mode, but I can only set it in a specify resolution, because of that, when I click to maximize my program, it goes like image #2... I tried to anchor buttons in "Top,Left,Bottom,Right" but the mess is bigger (image #3).
What I need: I want to make a single layout for a fullscreen mode in any screen resolution...
Image 1 below
Image 2 below
Image 3 below
When I use fill mode...
If I understand right and you want everything to stretch when you resize your form then you should dock your tablelayoutpanel (fill) and the same with your buttons.

Android layout scale with device dpi

I've created a basic layout. However, it is broken on my high-dpi device. How to center the whole layout?

Different Portrait layouts in android

Initially I developed my application for phones only in portrait mode. But now, I want to shift that to tablets as well, but in portrait mode only. My question is, can we define different layouts for portrait mode for different screen sizes. It works on tablets but the UI is stretched. If yes, how..? If someone could give an example.
Yes you can define the same layout for different sized devices.
Assuming you have the layout folder already, you can create another one called 'layout-xlarge'.
In here, create an xml layout with the same name as the one in the layout folder. Now when you run the app, only 10" tablets (devices designated as having extra large screens) will use the 'layout-xlarge' folder.
All other smaller devices will use the 'layout' folder.
Your folder structure will look like so:
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-xlarge/my_layout.xml // layout for extra large screen size
You can do the same for small and large screens, among others.
This is a rather brief description and you would do well to read this when you get a chance:
http://developer.android.com/guide/practices/screens_support.html
i think you have to create 3 layout in your resource folder and each one has same name xml file
that are
layout (contaning a.xml, b.xml, c.xml)
layout-large (also contaning a.xml, b.xml, c.xml)
layout-small (also contaning a.xml, b.xml, c.xml)
check your application on different size of emulators like QVGA, HVGA, etc.
Yes you can develop define different layouts for portrait mode for different screen sizes
res/layout/my_layout.xml // layout for normal screen size ("default")
res/layout-small/my_layout.xml // layout for small screen size
res/layout-large/my_layout.xml // layout for large screen size
res/layout-xlarge/my_layout.xml // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large screen size for land scale
by default res/layout/my_layout.xml this means you are going to create my_layout for portrait mode.
just take care of folder hierarchy .
for more details

Android wallpaper also sliding left and right when we swipe the home screen

I want to develop a new home screen application for android. I saw the default home screen in my android 2.3.3 device, when ever I swipe the home screen left and right, the background wallpaper also sliding left and right. What is that view? How to get the same effect in an app?
Is it ViewPager? I checked the ViewPager class, but I didn't found any common background image for all views in that.
You probably want to use a canvas with a draw-able, then detect the users swiping and animate it in the background. It is likely that the default android backgrounds are doing the same. You wont be drawing the unseen portions of the view.
http://developer.android.com/guide/topics/graphics/2d-graphics.html
I suggest doing their lunar lander tutorial to learn how to use the canvas first.
You will make a canvas the background to your app and then lay your other ui elements on top of it unless you make the ui based inside the canvas.

Resources