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
Related
I have downloaded Google and Facebook 9-patch button files and added them to my app.
It all seemed surprisingly straightforward, as it seemed to work just fine with just setting button background to the 9-patch file and setting some text. Here is the result:
The thing is, when I previewed my app on device with Android 4.0 and 4.4, this is the result:
What can be done, to make the buttons in Android 4 look like the ones in Android 5?
The reason for the buttons displaying wrong could be that the content area in the 9-patch file is wrong. You could try to open the files with the draw9patch tool, that is describe here. Then you can adjust the content area by adding to or removing from the black bars on the right and bottom.
Alternatively you could try adjusting the padding of your buttons
I have actually found a solution.
I used style="?android:attr/borderlessButtonStyle" to get rid of borders. For some reasons, it overriden the padding for buttons in version 4.
Once I changed it to style="#style/Widget.AppCompat.Button.Borderless" everything worked just fine.
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!
Random bug on mostly > 4.0 devices
Sometimes transparency that is set in .xml files is shown as white/light grey shade.
This happens for practically everything , TextView , ImageView , Button , Relative Layout...
Has anyone experienced this before ?
All I can find is a transparency bug in Jelly Bean that happens with secondary accounts , which isn't related to this.
I ran into the same issue, but was able to work around the problem by using the 8-digit color code in which the first two digits represent the transparency level (00 being fully transparent, FF being fully opaque).
Using #00000000 results in a fully transparent color and can be used as a direct replacement for android:color/transparent.
I have been trying to change the color of the gray that surrounds my custom tabs, I have tried looking for the answer on YouTube:
http://www.youtube.com/watch?v=IfrXE2R2nqM
http://www.youtube.com/watch?v=XMWlRXfKgtY
This helped me understand the process of 9-patch files but I must be doing something wrong for this not to work.
What I have tried doing so far:
In my project I see in the "Package Explorer" I see Android 4.1, which is in ...android-sdk/platforms/android-16. I opened that with winrar, went into res/drawable-mdpi and just to see if anything would change I replaced "tab_selected.9.png" and "tab_selected_v4.9.png" with the image of "tab_pressed.9.png". I then tried to compile my project just to see the same gray for the background of my tab buttons.
The current android project I am working on I placed the changed "tab_selected.9.png" and "tab_selected_v4.9.png" inside of my drawables folder and tried running it just to see the same thing.
Does anyone know what I am doing wrong, am I not compiling something or do I need to mess with different .9.png files? Or does anyone have a simple process just to change the gray color of these tabs? I guess the quick answer for me here is what would I have to do to get the image of "tab_pressed.9.png" to replace "tab_selected.9.png"
EDIT:
tab_selected.9.png
tab_pressed.9.png
Make sure the only pixels in the border are the 9-patch ones, either black (#f000 in ARGB) or fully transparent (#0000).
It's a normal to left some pixels with some transparency on those pixels that gets unnoticed at simple view.
This is a little tricky. Sometimes the stuff like the grey can creep in from the underlying Android layer. Sometimes things like tabhost have views that have to be overridden. I remember having to maek a selector drawable in XML to get the tabhost to work with custom items.
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.