I am using a TextView and specifying the text to be white, but it always shows up gray both in the VS preview window and on the device.
Why is this and what needs to change to make it show white?
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
>
<TextView
android:id="#+id/textviewLatLonEtc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_gravity="top"
android:background="#00000000"
android:textColor="#FFFFFFFF"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="UTC Latitude Longitude Altitude Grid HorizontalVariance"
/>
</LinearLayout>
Note - I did notice that if I made the ending LinearLayout tag misspelled, for example /Blah, that the Visual Studio preview window then displayed the text as white, not gray.
Is some weird setting getting inherited too much ? Looking forward for a solution to this.
OK, oops, found the problem. After reconstructing my page piece by piece, I found out that I had a secondary View with transparency of #80000000 (half transparency) so half the value was getting through.
I changed this to #00000000 and the full brightness of White is showing.
Related
anyone has had this issue?
I am making an android app and my text within textview is a light grey. It is not very visible, but that is the effect I want.
When I look at my emulator it is fine, but when i upload the app to my android device, the text is corrected and now appears as white with a black outline.
I don't want this. I want the light grey color...
here is the actual code for the full layout for those asking:
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_splash_screen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp"
android:layout_gravity="center"
android:background="#ffffff"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="some text here"
android:textColor="#888888" /> </RelativeLayout>
In the comments, #Ma3x asked in the comments:
Since also your battery level and your clock display text are white with a black outline, I assume this is something at your system's level. Do you have some high contrast accessibility turned ON or any custom system-wide UI modifications? Or is it just a default theme like that? –
That gave me the hint I needed. In Settings > accessibility > High Contrast.
I'm working with Android and I want to be able to have the equivalent of two backgrounds for one EditText, essentially. The text will change the color of the ET background as it types, but because it has to be slightly opaque so it's not a solid color, it may show the total View background color too, which will be changing from white as well. To solve this I would like to have a constant white background behind the color-changing translucent background behind the EditText. If any more practical, possible approach is apparent, please share!
put the edit text inside a another layout and set the background colour.
So if your xml was something like this
.
.
.
<EditText
android:layout_width="500dp"
android:layout_height="40dp" />
.
.
.
Now it will become like
.
.
.
<RelativeLayout
android:layout_width="500dp"
android:layout_height="40dp"
android:background="#color/White" >
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
.
.
.
I have a TextView. I want to set its background color. But the color fills more top space than it does bottom space.
<!-- red background. -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:background="#f00"
android:text="10.0" />
This is how it renders (zoomed in to demonstrate, green lines added by me):
So the extra space up top makes it look like the text is not centered within its own container. Is this expected? I'd like the text to appear vertically centered within its own container (the red area).
This is on a galaxy nexus, stock version of jellybean.
Thanks
Add the following attribute:
android:includeFontPadding="false"
while typing into EditText, text color automatically changing from black to white, initially i set the text color to white and set hint color also white, but when testing it, it shows typing in black color on start but while in mid or reach to a random number of characters, it turns to white text. its working fine Samsung Galaxy Gio, Nexus One and on different emulators but on HTC Evo 3G and some other devices, its showing this behavior!
I tried to fix by setting style to normal, text color to white, hint color to white and other things relating to focus etc, everything is set to white but still on some devices it is showing the behavior and continues to changing color in mid of typing.
Please let me know if someone is familiar with this and fixed any issue like this.
Here is the video demonstrating the issue.
http://youtu.be/1dydBvZnSHI
Here is my xml for this EditText
<EditText
android:id="#+id/email_edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/textView2"
android:background="#drawable/share_email_bg"
android:ems="10"
android:lines="1"
android:maxLines="1"
android:padding="5dip"
android:singleLine="true"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:inputType="textEmailAddress"/>
Well I am answering this because some may get benefit out of this. Actually I got the same problem in one of my device and after a long struggle I found that its a very silly mistake.
To solve this we just need to add one attribute in the <EditText> node. Here is the solution :
<EditText
android:textColor="#android:color/black"
..........
/>
Use:
android:textColorHighlight="#android:color/black"
in the textEdit if you refer to edit text down line change color when editing you need to set the color on:
android:backgroundTint="#color/colorPrimaryDark"
Both properties are set programmatically. I tried restarting, changing AVD - bu still when TextView background is set - text dissapears. And yes, it has different color then background. Without background text is visible. I don't know where is the problem...
{This code below works fine}
<TextView
android:id="#+id/txt_Number"
android:layout_width="match_parent"
android:layout_height="25dp"
android:gravity="center"
android:text="1"
android:textColor="#color/red"
android:textSize="10sp"
android:textStyle="bold" />
This code below show only background, no text :/
<TextView
android:id="#+id/txt_Number"
android:layout_width="match_parent"
android:layout_height="25dp"
android:gravity="center"
android:text="1"
android:background="#drawable/txtbg"
android:textColor="#color/red"
android:textSize="10sp"
android:textStyle="bold" />
The image is in png format with transparent background. TextView is inside a TableRow in TableLayout. This Layout is part of the ListView item - but I don't think it's the problem.
With background:
Without background:
In fact, there are 2 TextViews, one showing distance and the second numbers - the first one has no background. When I try to put a background to the second one - both texts dissapear.
I faced with the same issue. After some researching I still don't know reasons to provide to this situation. To solve it, I simply put a View with desirable background below TextView. Not pretty but works.