text in textview seems to be in white color in real device but in emulator is OK - android-emulator

The properties in a vertical layout are
<LinearLayout
android:id="#+id/buscador"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:orientation="horizontal" >
<AutoCompleteTextView
android:id="#+id/autoCompleteTextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="#string/searchcity"/>
<Button
android:id="#+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="#string/climaB" />
</LinearLayout>
In the Eclipse emulator for Android 3.0, the submitted text is perfectly seen but in my Android Froyo tablet it is not >:( . The app has minimun SDK = 8. Somebody had the same issue? What can be going on ? I also tried with Plain text TextView but in this case there was not problem neither of both, emulator and device. Sorry, forget to mention that the text in the textview is in color white when run the app in the Tablet, in the emulator is visible in dark color (black).

For Tablet and some android versions default Text Color is white , That is why you are getting white text color, add android:textColor attribute

check if you have dark mode on. If yes try again after disabling it.

Related

TextView blocking ListView onItemClickListener

I have simple list view with list items defined by following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/list_item_selector" >
<TextView
android:id="#+id/menuItemTextView"
android:clickable="false"
android:focusable="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#00000000"
android:padding="20dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/blue"
android:textIsSelectable="true" />
<ImageView
android:id="#+id/arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingRight="10dp"
android:src="#drawable/arrow" />
> </RelativeLayout>
When I click TextView the listView.onItemClickListener is not called. The problem occurs on Android 4. Android 2.x is OK. Is there any trick to pass an event from TextView to its ListView without defining onClickListner on the TextView?
In your main activity just make you listview as focusable true. This worked for me. If you are using a custom list view the focus is passed to its childs and not the list so to get the focus back to listview use
listView.focusable(true);
and the other things as textview just set their focus as false.
It was the android:textIsSelectable="true" attribute. Don't follow lint hints blindly.
android:inputType="textMultiLine" can also cause this problem. If you've included that attribute in your TextView xml, try removing it.

How to change TabWidget's background color from XML in Android

I have come across this problem. I have a tab widget on top of the view, with four tabs in it. I have been asked to change the background color of the whole tab view area. Not for any tab, but the whole area of that tab view.
I also been asked for not changing any source code for some branding reason. So I could only do it through xml file. I searched around but seems all solution is by using java code. So I wonder if there is a way that I could change the widget background color (just color, not images) by using only resources files?
Here is my layout file for the tab layout:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"
>
<TabWidget
android:id="#android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/tabbackgroundcolor" />
<FrameLayout
android:layout_below="#android:id/tabs"
android:id="#android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"
/>
</RelativeLayout>
</TabHost>
You could see that I added "android:background="#color/tabbackgroundcolor"" in the TabWidget part, however it not work..
Thank you!

Change Android AnalogClock Color

I try to change the AnalogClock color.
I want it Black instead of White.
Anybody know how can I overide this widget theme.
Thanks a lot .
<AnalogClock
android:id="#+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="500dp" />
You can change the images of the dial, hand_hour and hand_minute:
<AnalogClock
android:id="#+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
**android:dial="#drawable/my_dial_image"
android:hand_hour="#drawable/my_hand_hour_image"
android:hand_minute="#drawable/my_hand_minute_image"** />
Eduardo
connect-motion.com

Can any one point me to this "Take a picture" widget in google plus android app. Want to know how to create a UI of that type

Can any one help me out how how this widget can be developed as in attached.The widget in the attached is of "Take a photo" or select photo" UI. Just want to know how can we create this UI widget. Any tutorials/and discussions/reference would help.Thank You.
Use hierarchyviewer tool from Android SDK. I tried.
You can learn that this menu is a custom baked dialog or activity, created from FrameLayout, ScrollView, LinearLayout and Buttons.
So to make one, you'll have to roll your own in similar style.
Here is how the xml would look like. You'd have to have a background for the FrameLayout and also 2 for the buttons. One with a full rectangle and the other without the top line. Then some margins/paddings tweaking and you should be fine.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" android:layout_gravity="center_vertical|center_horizontal">
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" android:background="#444" android:textColor="#fff" android:layout_marginBottom="1dp"/>
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" android:background="#444" android:textColor="#fff"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
Note: this is based on Mice's answer.
I don't think its native android widget. May be you can find it on github try searching over there.
Use GreenDroid library, it has what you are looking for. It is a nice library with host of features. To test it download this sample application

Dynamically expanding widgets on Android UI

I'm trying to create a simple Android UI that consists of a EditText and Button widget. However I'm having some problems with setting the layout properties. The UI is supposed to look like this:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒▒
Left is the EditText and right is the Button. The Button (ImageButton) has a widths of approximately 50x50 which I would like to be fixed. The TextBox however should span the entire free space up to the button but I am not able to get this working. I would like to have this work dynamically so I don't have to specify a different layout for different screen sizes or orientation (if this is possible at all).
This is my first Android app so I appreciate any suggestions on how to best build the UI for an application.
Thanks,
b3n
This should place the elements how you wanted.
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal">
<TextView
android:layout_weight="0.5"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="text"/>
<Button
android:id="#+id/b1"
android:text="test"
android:layout_height="50px"
android:layout_width="50px"
/>