Tag: xml

How to change colour of the thumb in seekbar?

I have the default seekbar in my android app. I noticed that when the thumb on the seekbar is held, it turns yellow. Instead, I want it to turn blue when it is held. How can this be done? I apologize if this is a basic question, I am new to android development. Thanks.

Static android shortcuts for multiple flavors?

Is it possible to define static shortcuts for multiple flavors without duplicating the shortcuts.xml ? I have two flavors: main (package: com.test) free (package: com.test.free) The shortcuts.xml looks like this: <shortcuts xmlns:android=”http://schemas.android.com/apk/res/android”> <shortcut android:enabled=”true” android:icon=”@drawable/ic_shortcut_add_photo” android:shortcutId=”new_photo” android:shortcutLongLabel=”@string/new_photo” android:shortcutShortLabel=”@string/new_photo”> <intent android:action=”android.intent.action.VIEW” android:targetClass=”com.test.MainActivity” android:targetPackage=”com.test”/> </shortcut> The problem is that the package name in the intent can not […]

Define a custom style (theme) on an Android Switch component

I’m new to Android development and also on Android theming/customization that looks to be a wide subject… I’m trying to give my Switch component a special look & feel, but I don’t manage to achieve what I want, avan after looking many resources on internet. This is driving me crazy!! Thanks in advance for your […]

Shadow color on buttons depending on state in XML – Android

I’ve created custom ToggleButtons in Android and since all buttons inherit from the same xml I want to change how they act depending on state, so when the state is checked I want to change the shadow color but this does not seem to possible with the current SDK. I’ve created an xml file which […]

How can I declare a Fragment as hidden in an XML layout

My activity declares all of its GUI fragments in a single XML layout. It only needs to display a few of the fragments at launch time; the rest get shown as the user interacts with the app. A portion of the layout is as follows: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” > <fragment android:id=”@+id/map_panel” android:name=”com.example.MapPanel” android:layout_width=”match_parent” android:layout_height=”@dimen/map_panel_height” […]

Android options menu not displaying

I’m new to Android and I’ve been trying to add a simple add button as mentioned below list_menu.xml <menu xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:id=”@+id/menu_insert” android:icon=”@android:drawable/ic_menu_add” android:title=”@string/menu_insert” /> </menu> MyActivity.java @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.list_menu, menu); return true; } I […]

Android ADT: No fragment_main.xml, only activity_main.xml

I’m trying to learn how to program android applications, so I downloaded the ADT bundle that google supplied, and I tried following the tutorial that allowed me to create a simple application. However, during the procedures, there are several instructions telling me to open up the fragment_main.xml file, but my layout/res/ directory did not have […]

Theoretical question: load external XML-Layout file in Android

I thinks it’s probably not possible for security reason but just want to be sure: is it possible to create layout in Android from an external XML file? To be exactly: I’m creating XML output with XSL on a remote server. I could create the necessary layout direct on the server and then download it […]

Adding an image as textview's text background

Recently I’ve wanted to do something artsy with my new project like, as the title suggests, add a background image as a text’s background, rather than the typical constant color all around. Specifically, I have a gradient image for this text. Something like this Typically I would expect an xml drawable resource file type solution, […]

Android AutoCompleteTextView popup moving after displaying

When I use the autocompletetextview everything works fine except it keeps switching between two positions: the correct one right below the textview and quite a ways lower. It starts wrong, but almost immediately moves to the correct position. However this is very annoying when typing or backspacing as it happens for every letter. I am […]

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