Tag: android-layout

Android: failed to convert @drawable/picture into a drawable

In my drawable folder I have a few images and they all reference perfect, but when I try and add any more images with the exact same size in the same folder, and try to reference it, is flags up an error “Failed to convert @drawable/picture into a drawable”. I have tried the same image […]

Android Lint contentDescription warning

I am getting warning as “[Accessibility] Missing contentDescription attribute on image” for imageview. while using android lint What does that mean?

Disable soft keyboard on NumberPicker

I’m trying to deactivate the soft keyboard when using a NumberPicker to enter numerical values (for aesthetic reasons). This is my layout-xml-code: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”vertical” > <LinearLayout android:id=”@+id/linearLayout2″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center_horizontal” android:layout_marginBottom=”30dp” android:layout_marginTop=”30dp” > <NumberPicker android:id=”@+id/repetitionPicker” android:layout_width=”40dp” android:layout_height=”wrap_content” /> <TextView android:id=”@+id/textView1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_gravity=”center_vertical” android:text=”@string/repetitions_short_divider” android:textAppearance=”?android:attr/textAppearanceMedium” /> <NumberPicker android:id=”@+id/weightPicker” android:layout_width=”40dp” […]

Vertical line using XML drawable

I’m trying to figure out how to define a vertical line (1dp thick) to be used as a drawable. To make a horizontal one, it’s pretty straightforward: <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”line”> <stroke android:width=”1dp” android:color=”#0000FF”/> <size android:height=”50dp” /> </shape> The question is, how to make this line vertical? Yes, there are workarounds, such as drawing a rectangle […]

Instant run in Android Studio 2.0 (how to turn off)

How to disable Instant Run in Android Studio 2.0 Preview. When I go to the settings I see it and I can not remove the tick from “Enable Instant Run…”

What are the differences between LinearLayout, RelativeLayout, and AbsoluteLayout?

I am confused about the difference between LinearLayout, RelativeLayout, and AbsoluteLayout. Could someone please tell me the exact differences between them?

How to make layout with View fill the remaining space?

I’m designing my application UI. I need a layout looks like this: (< and > are Buttons). The problem is, I don’t know how to make sure the TextView will fill the remaining space, with two buttons have fixed size. If I use fill_parent for Text View, the second button (>) can’t be shown. How […]

requestFeature() must be called before adding content

I am trying to implement a custom titlebar: Here is my Helper class: import android.app.Activity; import android.view.Window; public class UIHelper { public static void setupTitleBar(Activity c) { final boolean customTitleSupported = c.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); c.setContentView(R.layout.main); if (customTitleSupported) { c.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.titlebar); } } } Here is where I call it in onCreate(): @Override public void onCreate(Bundle savedInstanceState) { […]

How to get RelativeLayout working with merge and include?

I have been trying for a few days now to make my layouts more efficient by converting from using several levels of nested LinearLayouts to one RelativeLayout and have come across a few problems that I haven not been able to find a workaround for… I have searched the Android beginners group and this site […]

ListView inside ScrollView is not scrolling on Android

I am having trouble with a scrolling ListView inside a ScrollView. I have an Activity which has some EditTexts in the top part and then a tab host with two tabs which have one ListView each. When the EditText views are focused, the soft keyboard comes up and as I have a ScrollView, the content […]

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