Tag: xml

android 9 patch drawable xml

Is there a way to define a 9 patch drawable in an android xml file? The reason I ask, is that when you apply a scale animation to a drawable w/ a stroke on it, the stroke appears to thicken. I’d like to make the stroke stay the same size as the animation plays…

Android: Create ListView in XML?

I want to create a list view with limited set of items that isn’t really going to change. Each row is going to have an image on the left and text on the right. (Just like in the Settings app) Can I populate that in XML (i.e. avoid writing code) ?

The attribute is not declared (Android) on basic xml attributes

I’m new to this Android development, and I find the layout of it really confusing. I’m trying to have a background image on a view, and I’ve tried using this example Add a background image to shape in xml Android, but it looks very bad (bitmaps you know) So I thought vectors could be fun. […]

ImageView src with drawable selector ignores enabled state

When using a state selector as the src for an ImageView, enabled=”false” is being ignored. i.e. this doesn’t work properly: <ImageView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:enabled=”false” android:src=”@drawable/state_drawable” > P.S. : I have an ugly workaround, I’ll post it as an answer shortly, if you have something better or an explanation for this behavior, please let me know.

Disable EditText editability and focus (like TextView)

Is there a way to make EditText behaviors like TextView in Android (XML is prefered)? I have tried the following: android:editable=”false” android:focusable=”false” android:focusableInTouchMode=”false” android:cursorVisible=”false” android:longClickable=”false” This works but I still can touch the EditText to get focus (the orange boarder), though the focus lost as soon as I remove my finger. I’m not sure what […]

Parsing a XML HttpResponse

I’m trying to parse the XML HttpResponse i get from a HttpPost to a server (last.fm), for a last.fm android app. If i simply parse it to string i can see it being a normal xml string, with all the desired information. But i just cant parse the single NameValuePairs. This is my HttpResponse object: […]

Align spinner values to right instead of left

In spinner xml, I’m using: android:entries=”@array/cars” where cars is list of numeric items. The spinner automatically align values to left, and I can’t find in xml/code how to change it.

android.widget.TextView cannot be cast to android.view.ViewGroup

So I don’t see where it is casting it into android.view.ViewGroup I get this error message when I try to view my xml in the graphic view. I haven’t done anything to the actual java this pertains too. <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”#ffffffff” android:orientation=”vertical” > <TableLayout android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:layout_gravity=”center” android:stretchColumns=”1″ > <TableRow android:layout_width=”fill_parent” android:layout_height=”1.0dp” android:background=”@drawable/list_divider_holo_light” […]

No rendering target selected using Android Studio

My Android Studio in activity_main.xml showing this problem: “Rendering Problems No render target selected” Help?

How to insert “<<” text in TextView?

I need to insert “<<” in android:text = “<<” but there are raise problem with: Multiple annotations found at this line: – [I18N] Hardcoded string “<<“, should use @string resource – The value of attribute “android:text” associated with an element type “Button” must not contain the ‘<‘ character. Can you tell me how can I […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.