Tag: xml

Android – DataBinding with Preference activity

I set up the data binding in xml but when i go to the preference activity to actually set up the binding i cant. The file where the data binding xml is in is called preference.xml so i assume there should be a generated class called PreferencesBinding but instead there is not. Should it not […]

Can I preview the Action Bar in the graphical layout editor?

I’ve noticed that all of the ApiDemos construct the Action Bar programmatically at runtime. I’d love to be able to see the Action Bar with icons and even tabs from within the graphical layout editor. Is it possible to preview the Action Bar in the layout editor, or is it necessary to build the Action […]

Android – Unknown attribute style on a fragment tag

Can someone please explain to me why I am getting this warning in Android Studio 1.1.0: Unknown attribute style Full warning: The inspection highlights unknown XML attributes in Android resource files and AndroidManifest.xml Here is the code snippet: <fragment android:id=”@+id/frag_logo” tools:layout=”@layout/fragment_logo” style=”@style/FragmentLogo”/> The warning occurs on the style attribute. I am using gradle and android […]

How to retrieve parts of Wikipedia content into Android App?

Basically, I want to retrieve content from wikipedia. But I want to display it inside my Android Apps directly. Not immidiately redirect to the internet browser, but to display it inside my apps first. Currently, I manage to request the Wikipedia API and get only the main content by using http://en.wikipedia.org/w/api.php?action=parse&prop=text&format=xml&page=Bla_Bla_Bla. and because I parse […]

How to avoid Eclipse leaks on XServer when editing Android XML files?

When I’m editing XML files in Eclipse (mainly, Android layouts and so), it causes leaks on XServer and it ends eating all my RAM (4GB), so I have to Ctrl+Alt+Backspace to continue. Do you know any remedy for that?

Mapbox Inflate View on Fragment

I am having issues inflating a Mapbox MapView on an Android Fragment. When I use the same code on an Activity (other than standard differences between an Activity and a Fragment), I can get the MapView to load correctly, but not on the Fragment. Mapbox also has a MapFragment class here, but I am unsure […]

Can't activate Preview mode Android Studio

I am trying to switch over to the new Android Studio (awesome btw) but I can’ activate the “Preview” window to view my XML files like they demo’d in I/O. When I navigate to View–>Tool Windows–>Preview ‘Preview’ is greyed out and I can’t select it. Does anyone know a fix for this?

StateListDrawable and tiled bitmap

This is my custom selector (StateListDrawable) <selector xmlns:android=”http://schemas.android.com/apk/res/android”> <item android:drawable=”@drawable/common_cell_background” /> <item android:state_pressed=”true” android:drawable=”@drawable/common_cell_background_highlight” /> <item android:state_focused=”true” android:drawable=”@drawable/common_cell_background_highlight” /> <item android:state_selected=”true” android:drawable=”@drawable/common_cell_background_highlight” /> </selector> Both, common_cell_background and common_cell_background_highlight are XML. Code below: common_cell_background.xml <bitmap xmlns:android=”http://schemas.android.com/apk/res/android” android:src=”@drawable/common_cell_background_bitmap” android:tileMode=”repeat” android:dither=”true”> </bitmap> common_cell_background_highlight.xml <bitmap xmlns:android=”http://schemas.android.com/apk/res/android” android:src=”@drawable/common_cell_background_bitmap_highlight” android:tileMode=”repeat” android:dither=”true”> </bitmap> Bitmaps are also exactly the same. Highlight is just […]

Element ignore is not allowed here, in Android lint.xml

I’m currently working on reducing the lint warnings/errors in my Android project. I’m fixing as many as possible, but some don’t apply to my project and others come from 3rd party libraries etc. So I’m setting up some lint rules in a lint.xml file within my app/ so that it gets automatically picked up. Here’s […]

Android: Alignment of four squares

I am trying to align four equally sized squares on an Android Screen & I have now tried what feels like a million different approaches, yet none of them seem to work :(. What I’ve got at the moment is the following: <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:id=”@+id/MasterLayout” android:layout_width=”wrap_content” android:layout_height=”fill_parent” android:background=”#FFFFFF”> <TableLayout android:layout_width=”fill_parent” android:id=”@+id/mainlay” android:background=”#444444″ android:layout_weight=”0.2″ android:layout_height=”wrap_content” android:padding=”0dip”> […]

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