Distorted buttons and edittexts - android

I have an issue with the rendering of some views (buttons and edittext) which edges are distorted (the left and right edges appear 1 px below the body of the control). Controls on my device behave like that, but not on the emulator. Does anyone know the reason of this?

Maybe take a look too to this : http://developer.android.com/guide/practices/screens_support.html
Maybe you have a density issue or something like that.

When setting the layouts, are you adjusting them to the appropriate 'fills'?
WRAP_CONTENT, FILL_PARENT. The views you are creating will need to be set so they appear correctly within the layout.
Posting some code for us to look at will help us better help you.

I got the same problem. I solved it by changing the skin built in to HVGA.
procedure is as follows:
In Eclipse SDK go to Window--> Android SDK and AVD Manager-->Virtual devices....
select your Android Virtual Device....
click on Edit...
change Skin Buil-in to HVGA..
and Click on Edit AVD...
If u r already using HVGA go for Higher version..
I changed it from QVGA to HVGA...
I hope this is on alternative to solve the problem on emulator.

Related

Weird artifact showing through nine-patch button

I have created a simple 9patch to use for my button graphic.
When I view it as part of the layout editor, it appears to look okay.
However, when I run it in an emulator I get this ugly looking artifact/relic around the bottom left/top right corners.
Does anyone know what causes this, and how I might fix it? I'm currently applying the 9patch using the android:background property.
First, I think, you should test it on real device. I had similar problem with AVD. When I connected my LG everything was OK.

Android Preview vs Emulator Layout Size

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.

layout on android studio preview doesn't look the same when running the app on the phone

im developing an android app on android studio, when i run my app the layout looks a bit different from the preview as well as on other phones,
for example: the buttons are in different order (from right to left instead from left to right) or other changes similar to this.
as well as on some phones the layout doesn't fit perfectly on the screen for example: the buttons on the sides of the screen appear to be cut out.
how can i fix it so the app will look the same with every phone and not only some of them?
About the Right-to-left/ Left-to-right, you can choose the globe icon in the preview options bar frame and then choose Preview Right-to-Left Layout option. This will "fix" the buttons order in preview.
About the buttons that appear to be cut out - make sure you use dp units instead of pixels. You can read more about it here:
http://developer.android.com/guide/practices/screens_support.html
Make sure you check if you have used the constraints on your components properly. Usually that's what makes the layout messy after running the app on your phone/emulator, even tho it looks perfect on your XML file.

Can't set background for TabWidget android

I searched a lot but could not find specific solution for my problem. I am posting a screen shot where you can see a tab widget. Also there is an exclamation mark there don't know why! You can see on the right bottom corner there is Background set to drawable. I have put the same named drawable into x,m,l,s, dpi folders. Also you can see in the Screen shot that there is API 8 used. Now the problem that I am facing is I can see the background set for 4.0 but not for 2.2! I have used setBackgroundResource also in class file, I tried to set alpha 0 for this tabwidget also. But don't know why its not taking my image as its Bg for API 8!! Thanks all would appreciate any relevant help.
i did try it like you and same result.. with normal tabhost on api 8.
But finally i did download :
http://code.google.com/p/android-custom-tabs/downloads/detail?name=customized-tabs.zip&can=2&q=
And as sample edit tab_bg_unselected.xml change it to transparent instead of that gradient.
put a solid element with android:color #android:color/transparent and it would be transparent after.
Then set a backgroundimage to the tabhost and its working nice.
Author article is : http://joshclemm.com/blog/?p=136
I think this is a very good solution and you could even make greater customization with that one.
Its a nice workarround, hope you could like it :)
Here a screenshot on a real 2.2.1 Motorola Milestone
Note : Did even verify it on latest Nexus 7 4.3 tablet and S2 4.1.2

ActionBarSherlock leads to icons get stretched

We have started integrating ActionBarSherlock into our app. Everything looks great, it's a really great lib, that gets in easily. But, there's one issue we don't know how to solve:
Some of the icons on some pages for larger screens get stretched. Has anybody had such problem?
Upd. 1.: Device that has icons stretched is running on Android 4.2.2 (it's Nexus 7 actually). All ok on a smaller screen like HTC Desire (2.3.3).
Upd. 2.: As the example of what is happening: there's an icon of a size of 48x52 pixels. It is in the "drawable" folder. It is used as the background for a Button widget. Before the update the app used this icon as is, i.e., it looked like 48x52. Now, looking at the element borders it looks as if the app is stretching the widget's width to be 52x52 or even wider, keeping the height same. layout_width, layout_height are set to "wrap_content"
Ok, using this answer I managed to fix -
changed all the Buttons to ImageButtons
all the android:background-s to android:src-es
android:background-s set to 'transparent'
But! I don't know why it happened and why it worked! Any clues? Thank you!

Categories

Resources