UI Question, which layout to use (new to Android)

  • Replies:1
mark beckworth
  • Forum posts: 1

Aug 22, 2011, 9:52:28 PM via Website

I have developed on the Blackberry platform and have just made the move to android. The layouts are a little different.

I'm trying to figure out which layout object to use for the following UI:

Screen
-----------------------------------------------------------------------
Title text
-----------------------------------------------------------------------
ListView control with vertical scroll capability



-----------------------------------------------------------------------
EditField Button
-----------------------------------------------------------------------

This is not unlike a chat window. I found that if I can figure out how to structure a window like this, it answers a lot of questions on how to do layouts of other screens/windows/activities.

I created a layout file for this as follows (Doesn't include button):

<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal" xmlns:android="http://schemas.android.com/apk/res/android">

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/app_title"
android:textSize="@dimen/title_font_size"
/>

<ListView android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/listView"
android:scrollbars="vertical"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarStyle="insideOverlay"
android:scrollX="0px"
android:scrollY="0px"
android:fadeScrollbars="false"
android:layout_alignParentTop="true"
/>

<EditText android:layout_width="fill_parent"
android:layout_height="wrap_content" android:id="@+id/filterText">
<requestFocus></requestFocus>
</EditText>
</LinearLayout>

I load the ListView with enough data to produce a scrollbar, but the edittext field is never visible.

Any thoughts?

Reply