Folks,
I cant design my android screens and see it on my emulator somehow the resolution, zoom (whatever) in the emulator is big and my layout is messed up.
The whole layout is inside a FrameLayout, the paragraph text in the emulator pic is inside a RelativeLayout, which is set to GONE after users upload rating, then LinearLayout shows up with the overall rating bar in the some place where the RelativeLayout was.
My question is why is this happening since in the preview it seems perfect and on the emulator it seems all messed.
Please see the screenshots:
Android Studio Preview:
Genymotion Emulator
It is really hard to determine what exactly is wrong without seeing your xml markup.
Possible Reasons
You gave your layouts some sort of fixed size, and therefore it appears to be fine on your markup, but whatever you are emulating on Genymotion is using a different ratio.
When you do a View.GONE, you say you are replacing a RelativeLayout with a LinearLayout. Well, do you make sure that the layout that is replaced is layoutAbove whatever that frame layout below it is?
Some layout just has some attribute, like an alignment issue, that is causing this.
Trace your steps backwards, removing one thing at a time. Get it to work with that view gone first, then add it and manipulate it after.
Related
I know this glitch is just visual, but it can get disturbing. So i made a relative layout holding a buttons. I wanted to use the XML visualizer, but when I drag around the relative layout, it redraws a lot and makes it so theirs many picture of the layout. Actually, it dose that for all my layouts! (The bigger ones are less noticeable) Note that this stops as soon as I stop dragging.
Here is a screen shot:
This happens most of the time when I use the xml editor. How can I fix this?
Just In case someone is experience such things, this has been patched in the latest android studio version.
Image of XML code and Design Differnce
In this there is a space left right of the image in AVD but in preview, space is fully covered for ImangeView
Same in case if TextView
I want the AVD design same as Preview. Is there any solution of the problem please help
You have to set the layout_centerOrizontal in "true" for each graphical component. It will solve the question of horizontal align issue. But, the preview cannot show all the devices, have this in mind. So, you have to predict somehow to achieve better performance for differents functions and diffents devices.
In your case, with your example, you have to make the all components be on the center (i'm guessing that is what you want). You can work with padding too. So in order to fill the space in a better way (not too empty, like the space below the images on the first image), you can use margin and padding settings that can bring a better looking.
I started the "Android 6 for Programmers: An App-Driven Approach" book and ran into a problem. I was following the step-by-step approach for one of the apps and got a pretty frustrating error that I cannot fix.
I've added a text and image views and on the Preview section they are shown as they should be but when I run the app on the emulator or on an actual device the text seem to be missing. I am going to attach photos below for more clarity.
The custom colour is Material Blue 500 (#2196F3). Tried changing it to another but the problem doesn't seem to be affected by it.
The text size is 40sp (80sp on a > 600x600 device).
You need to change tools:text to android:text. Using tools attribute you can only see preview in design time.
Try to remove Layout weight, it might be the problem .
When using a LinearLayout and layout weights, set height in your case to 0dp for both the text and image
If you're wanting to center things and align to each other, RelativeLayout or ConstraintLayout would be preferred.
I have two cell phones.When I run same app on both phone is not properly work. For fix that problem i use sw120dip and sw360dip layout. But i cant solve this error.
How can i solve this error.
Use the Relative layout by the way if you are using other layout and design it with the Android Studio Design instead of using xml .In this way you can see the layout of screen without running the app on real phone.
If you use relative layout with all dimensions in "dp" and font sizes in "sp" then it has to fit in all screen size. I have never seen scenario unless one is using fixed layout. Pls paste your layout to get more details about your questions.
I am fairly new to android and am having some problems with a layout. Below is an approximation of what I want the layout to look like. (I would like the list to be below the screen at first so that the user can scroll down to see it.) However my code as it currently stands makes all of the views on the left only take up a quarter the screen instead of half, as depicted, even though I have all widths set to fill_parent.
Also, this layout seems to mess up the coordinate system on my custom view. Normally this wouldn't be much of an issue, but in this case I am using that view to draw a picture and the picture ends up in the wrong place. Does anybody have any idea how to resolve these issues?
Could you show the XML file you are using? This would be helpful. Also, the coordinate system of a View does not change based on the layout.