A user of my open source app, JustNotes, made an interesting observation… if your note gets too long, you can’t read it because it goes below the keyboard and you can’t scroll it upward. You can read the bug tracker issue on my GitHub for the full story. This is a really great point. I guess I had always thought of using this app for small, short notes, but it is conceivable to make a list or note that was longer than the top half of your screen.

Fortunately, I’ve progressed a bit in my programming skills since then, so I was able to fix it in about ten minutes. Essentially, I just added a scroll field for the text, like so:

justnotes_gif

<?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:id="@+id/content_writenote"
    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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.alaskalinuxuser.justnotes.writenote"
    tools:showIn="@layout/activity_writenote">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="top|center"
        android:orientation="vertical">

    <EditText
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:inputType="textMultiLine"
        android:ems="10"
        android:gravity="top|left"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:id="@+id/multiTextView" />

    </LinearLayout>
    </ScrollView>

</RelativeLayout>

As you can see, I just implemented a ScrollView around the LinearLayout. Simple. Functional. Just the way I like it!

Linux – keep it simple.

Leave a Reply

Your email address will not be published. Required fields are marked *