Tag: xml

Comments in Android Layout xml

I would to enter in some comments into the layout XML files, how would I do that?

Question mark (?) in XML attributes for Android

Can anyone explain the question mark means in Android XML attributes? <TextView style=”?android:attr/windowTitleStyle” More attributes />

What is the 'app' Android XML namespace?

Here is an example of the app namespace that I’ve seen from a res/menu/main.xml file <menu xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schemas.android.com/tools” tools:context=”.MainActivity” > <item android:id=”@+id/action_settings” android:title=”@string/action_settings” android:orderInCategory=”100″ app:showAsAction=”never” /> </menu> What purpose does the app namespace serve? Is it a “standard” Android XML namespace? Are the same value options available for the same attribute placed in two […]

Android: remove left margin from actionbar's custom layout

I am using a custom actionbar view, and as you can see in the screenshot below, there is a blank gray space in the actionbar. I want to remove it. What have I done: res/values-v11/styles.xml <style name=”AppBaseTheme” parent=”@style/Theme.AppCompat.Light”> <item name=”android:actionBarStyle”>@style/ActionBarStyle</item> <item name=”actionBarStyle”>@style/ActionBarStyle</item> </style> res/values/my_custom_actionbar.xml <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”ActionBarStyle” parent=”@style/Widget.AppCompat.Light.ActionBar.Solid”> <item name=”android:height”>60dp</item> </style> </resources> Manifest <uses-sdk […]

“ArrayAdapter requires the resource ID to be a TextView” xml problems

I am getting an error when trying to set my view to display the ListView for the file I want to display(text file). I am pretty sure it has something to do with the xml. I just want to display the information from this.file = fileop.ReadFileAsList(“Installed_packages.txt”);. My code: public class Main extends Activity { private […]

Remove icon/logo from action bar on android

I’ve been trying to find some way of removing the icon/logo from the action bar but the only thing I’ve found after an hour of searching SO, Android’s documentation and Google is how to remove the title bar in whole. That is not what I want. Only want to remove the icon/logo from the title […]

Error inflating when extending a class

I’m trying to create a custom view GhostSurfaceCameraView that extends SurfaceView. Here’s my class definition file GhostSurfaceCameraView.java: public class GhostSurfaceCameraView extends SurfaceView implements SurfaceHolder.Callback { SurfaceHolder mHolder; Camera mCamera; GhostSurfaceCameraView(Context context) { super(context); // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = getHolder(); mHolder.addCallback(this); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); […]

How to get the selected index of a RadioGroup in Android

Is there an easy way to get the selected index of a RadioGroup in Android or do I have to use OnCheckedChangeListener to listen for changes and have something that holds the last index selected? example xml: <RadioGroup android:id=”@+id/group1″ android:layout_width=”fill_parent” android:layout_height=”wrap_content” android:orientation=”vertical”> <RadioButton android:id=”@+id/radio1″ android:text=”option 1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” /> <RadioButton android:id=”@+id/radio2″ android:text=”option 2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” […]

Defining Z order of views of RelativeLayout in Android

I would like to define the z order of the views of a RelativeLayout in Android. I know one way of doing this is calling bringToFront. Is there are better way of doing this? It would be great if I could define the z order in the layout xml.

Referencing a string in a string array resource with xml

I have preferences where you can enable/disable what items will show up on the menu. There are 17 items. I made a string array in values/arrays.xml with titles for each of these 17 items. I have preferences.xml which has the layout for my preferences file, and I would like to reference a single item from […]

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