Skip to content

Instantly share code, notes, and snippets.

@simoales
Last active November 22, 2017 17:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simoales/6e8b9425d8b53622f4c8cd85b2657b17 to your computer and use it in GitHub Desktop.
Save simoales/6e8b9425d8b53622f4c8cd85b2657b17 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:weightSum="1"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.todos.TodoListActivity"
tools:showIn="@layout/activity_main">
<Spinner
android:id="@+id/spinCategories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:entries="@array/categories_array"
/>
<ListView
android:id="@+id/lvTodos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/spinCategories"
android:layout_marginTop="15dp"
/>
</RelativeLayout>
@alextech1
Copy link

alextech1 commented Nov 22, 2017

It would help if you upload you "dimens.xml" file because on Android 3.0+ it is giving an error with:

android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"

Fixed it by, going to res > values > dimens.xml and added this to resources:

<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment