How to properly change Tab Background in Android - android

I am a newbie to Android Development, and facing this particular problem while changing TabBackground Image.
As you can see in the attached Image, there is a thin gray line. And I am unable to figure out where is it coming from. Can you please assist me in removing it.
I have checked there is no padding anywhere, and android:layout_width="wrap_content" and android:layout_height="wrap_content".
Actual Tab Background Image

Just in XML file where you have mentioned a tag called "Tab-widget", in it write
android:tabStripEnabled="false"
It will make sure that the bottom line under all the tabs will disappear.

Related

android studio issue: complex Layout is not showing in design view but just as XML

I have a somewhat complex layout.xml file (353 xml lines, 16kb) with multiple nested constraint layouts. This particular xml file is only showing a blank white screen in the design tab but works well when I run it on device and emulator. I have other smaller layout files which show the design normally on android studio but it seems that there is a bug with viewing larger xml files.
Is this a known issue? I tried refreshing layout and removing android studio cache but nothing seems to work. any ideas?
I do not think it has anything to do with the code since it runs normally on device and I am not sure posting the whole xml file on SO is a good idea.
update
What I realised is that all the elements in the layout seem to be 'invisible' at the top left corner since when I hover over them the pointer turns into a hand and when I click , certain elements get highlighted in the component tree. This is a screenshot of what I am seeing:
I added android:visibility="gone" which is vital to my app. Little did I know that it also applies to the design view which I find to be really useless. I want the visibility to be gone during runtime, not on a platform where I am supposed to be tweaking the design of the UI. This is ridiculous to me.
Does anyone know If I can keep visibility="gone" but still see the design in the design view of the layout?
You can use tools:visibility="visible" for designing purposes.
It has zero effect on the view in real use.
Don't forget to keep your android:visibility="gone".
In general, use tools attributes whenever you'd like to manipulate a preview in the designer while keeping your view attributes valid for real use.
Edit:
Keep in mind that there is a huge difference between invisible and gone. More about that

Android Studio can't add elements to the layout

I'm trying to create my first app in Android Studio with Kotlin. The installation worked fine. However if I drag any element onto the Layout, it's not showing up properly. The only change I can see, is a little white dot, that appears as soon as the Layout contains any element. I can select it and view the element attributes on the right, but nothing more.
If I run the app, all elements are squashed in the top left corner.
I already reinstalled Android Studio.
Does anyone know how to fix my problem?
Thaks in advance!
Here is some more information:
XML Code,
Error messages
Make the constraint layout width and height as match_parent in text editor. and then try adding widgets in the design view.
Here is some more information:
XML Code,
Error messages

Graphic Layout not displaying correctly

I'm setting up two small buttons but in the graphic layout the text comes cut off
But when I run the app the text displays correctly or at least how it is expected.
I know this might be an eclipse configuration but I can't seem to find it.
Any ideas?
Edit: I forgot to add the xml configuration.
http://textdump.net/read/4292/

Custom progressDialog xml

I want to know where I can find the original XML used for the progressDialog because I want exactly the same design except change color of the background, border,text color and center also the rotating image.
I tried to use my own XML layout, but I didn't succeed in reproducing the same design as the original one (the small arrow, the line between the title etc....)
http://thedevelopersinfo.files.wordpress.com/2009/10/with_title2.jpg
Big thanks !
You can find it in your android sdk directory.
\android-sdk\platforms\android-XX\data\res\layout\progress_dialog.xml

Android ListView being replaced by a drawable or showing incorrect background

I am seeing some very weird behavior with a set of ListViews that I have in a single Activity.
I have 5 ListViews that make up a custom control that acts like a lock combination on a briefcase. All 5 of these have transparent backgrounds and they are overlaid on top of their background using a RelativeLayout.
Every once and a while, all 5 of the ListView backgrounds will be filled with a drawable png image that I have on the same Activity. When this image shows up, there are no elements in the ListViews like their should be. I usually clean the project and push it back onto the phone which fixes the problem. However, I am trying to figure out if the issue will happen whether or not it worked out of the box.
I am not sure if the ListView is being entirely replaced by the drawable. I DO know that there are never any elements in the ListViews when the issue occurs.
What would cause the issue of an image resource showing up as the ListView, instead of the ListView and their contents?
Update:
I thought this could be resolved by cleaning/rebuilding the project, however I'm now finding out that this problem occurs during run-time.
After replace an image on the home screen, I found that the image being incorrectly loaded into the ListView is actually from another Activity.
If I used my own transparent #00000000 color for the android:divider of the ListView, I would see this issue.
The fix was to use #android:color/transparent instead, and the behavior corrected itself.
If the image is the background of a parent element in your layout XML, then it will show up when your lists are empty.
Alternatively, does your ListView specify an empty image to be displayed when there are no elements in the list?

Categories

Resources