Android Forum » Android Developer Forum » Android Developer Forum » UI Question, which layout to use (new to Android)

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

UI Question, which layout to use (new to Android)
created on Aug 22, 2011 9:52:28 PM
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 with quote Reply Link ±0     (0 votes)
RE: UI Question, which layout to use (new to Android)
created on Oct 3, 2011 7:18:41 AM
Just replied to another similar question. I'm going to point you to the same link :)
The post actually talks about setting up layouts in general. I hope it can be of help.
http://droidcoders.blogspot.com/2011/09/android-displaying-widgets-in-grid-like.html

At least it helped me.
Reply with quote Reply Link ±0     (0 votes)