Why is HorizontalScrollView scrolling to right? - android

The below XML contains an EditText control. As soon as I touch it, the softkeyboard appears but the HorizontalScrollView scrolls to the right so I cannot see the EditText!
Can somebody please tell me what is wrong with the below XML and why it is doing this?
Please excuse hardcoded widths - this is only a test bit of code for sanity checking.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<HorizontalScrollView
android:id="#+id/testScrollView"
android:layout_width="1280dp"
android:layout_height="match_parent"
android:scrollbars="horizontal"
android:background="#00FF00">
<LinearLayout
android:id="#+id/layout"
android:layout_width="2560dp"
android:layout_height="match_parent"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/mLeftBaseLinearLayout"
android:layout_width="1280dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#FF0000">
<EditText
android:id="#+id/mEditText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#BBBBBB"
android:gravity="center"
android:text="EditText"
android:textColor="#FFFF00"
android:textSize="30dp"
android:singleLine="true"
android:clickable="true"
android:editable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:inputType="text"/>
<ListView
android:id="#+id/mListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#80FFFFFF" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/linLayout"
android:layout_width="1280dp"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#00FF00">
<Button
android:layout_width="600dp"
android:layout_height="wrap_content"
android:text="Button1" />
<Button
android:layout_width="600dp"
android:layout_height="wrap_content"
android:text="Button2" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</FrameLayout>
My tablet is running Android 4.2.1

Ok, I have been looking at your layout and made a few changes and it looks ok on my computer.
Firstly, mEditText is unnecessary and avoidable. If you want a header for mListView
yourListView.addHeaderView(View v, Object data, boolean isSelectable);
This is what I did:
<?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" >
<HorizontalScrollView
android:id="#+id/testScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FF00"
android:scrollbars="horizontal" >
<LinearLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/mLeftBaseLinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FF0000"
android:orientation="vertical" >
<EditText
android:id="#+id/mEditText"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#BBBBBB"
android:clickable="true"
android:editable="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:inputType="text"
android:singleLine="true"
android:text="EditText"
android:textColor="#FFFF00"
android:textSize="30dp" />
<ListView
android:id="#+id/mListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#80FFFFFF" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/linLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FF00"
android:orientation="vertical" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button2" />
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
If this does not work we need to look at your code.

I found my solution - override scrollTo() and do absolutely nothing.

Related

Organizing layouts with edit text at bottom?

I wanted to make a layout with 3 LinearLayouts. In the 2nd LinearLayout I would have a ListView and the 3rd LinearLayout I would have an EditText and Button at the bottom. This was my attempt:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/view_post"
android:layout_width="fill_parent"
android:layout_height="200dp"
android:background="#color/com_facebook_blue">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/view_status"/>
</LinearLayout>
<LinearLayout
android:id="#+id/view_comments"
android:layout_below="#+id/view_post"
android:layout_width="match_parent"
android:layout_height="250dp">
<ListView
android:id="#+id/lv_comments_feed"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
<LinearLayout
android:layout_below="#+id/view_comments"
android:id="#+id/send_message"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<EditText
android:id="#+id/write_comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:gravity="top|left"
android:inputType="textMultiLine"
android:scrollHorizontally="false" />
<Button
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</RelativeLayout>
Now the design looks great but when I load the app on my phone, I have 2 problems:
I don't want to hardcode the LinearLayout heights. I have looked into layout_weight but I can't seem to have these layout_weights work without running into the 2nd problem below:
When I click the EditText, the EditText is hidden even though I have declared android:windowSoftInputMode="adjustResize|stateHidden" in my activity and I'm not sure why that's happening. Also, the EditText and Button are not directly at the bottom of the screen which is what I would want. Any help is appreciated, thanks!
you don't need to add listview as child of linear layout. and avoid fill_parent & use match_parent. if first linear layout is only for textview then don't use it inside of linearlayout. or only use wrap_content instead of a specific layout_height
Here i made some changes hope it will work
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/view_post"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="#222dc9">
<TextView
android:id="#+id/view_status"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/send_message"
android:layout_below="#id/view_post"
></ListView>
<LinearLayout
android:id="#+id/send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
<EditText
android:id="#+id/write_comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_weight="5"
android:gravity="top|left"
android:inputType="textMultiLine"
android:scrollHorizontally="false" />
<Button
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text="send"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</RelativeLayout>
and use in Manifest with activity name is
android:windowSoftInputMode="adjustPan"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<RelativeLayout
android:id="#+id/view_post"
android:layout_width="match_parent"
android:background="#color/material_grey_300"
android:padding="5dp"
android:layout_height="wrap_content">
<TextView
android:id="#+id/view_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/view_comments"
android:layout_above="#+id/send_message"
android:layout_below="#+id/view_post"
android:layout_width="match_parent"
android:background="#color/material_deep_teal_200"
android:padding="10dp"
android:layout_height="match_parent">
<ListView
android:id="#+id/lv_comments_feed"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</ListView>
</RelativeLayout>
<LinearLayout
android:id="#+id/send_message"
android:background="#color/material_blue_grey_800"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<EditText
android:id="#+id/write_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="textMultiLine"
android:scrollHorizontally="false" />
<Button
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:layout_weight="1"
android:text="send" />
</LinearLayout>
</RelativeLayout>

Item to right Side?

I am trying to keep all item to right side I find code in Google but it is not working with me.
latest_lsv_item.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.apps.newsapplication"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/list_bg"
android:orientation="horizontal" >
<com.example.util.RoundedImageView
android:id="#+id/img_newslistlatest"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center"
android:layout_margin="13dp"
android:scaleType="centerCrop"
app:border_color="#color/divider"
app:border_width="8dip"
app:round_background="true" />
<TextView
android:id="#+id/txt_newslistheadinglatest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="0dp"
android:maxLines="3"
android:text=""
android:textSize="18sp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/text_color" />
</LinearLayout>
fragment_lastest.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background_color"
android:gravity="center"
android:id="#+id/rootlayout"
android:orientation="vertical" >
<ListView
android:id="#+id/lsv_latest"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="#color/divider"
android:dividerHeight="1dp">
</ListView>
</LinearLayout>
if you want more code or file I will past it here...
activity_main.xml
LastFragment.java
etc...
I try to use RTL but also not working with me

Android - Messaging application layout

I am trying to reproduce the layout from the stock Android messaging app. I've done this using a list view with a custom adapter for the conversation and a fixed layout for the "send message" part. It looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp" >
<ListView
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/sendMsgLayout"
android:overScrollMode="always"
android:stackFromBottom="true"
android:layout_alignParentTop="true" >
</ListView>
<RelativeLayout
android:id="#+id/sendMsgLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="20dp"
android:layout_marginBottom="5dp" >
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
<EditText
android:id="#+id/messageText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_toLeftOf="#+id/imageSend"
android:hint="#string/type_message"
android:maxLines="3" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/imageSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/messageText"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:src="#drawable/send" />
</RelativeLayout>
This is my latest version of the layout, I've also used a LinearLayout as the parent with weight set to 1 for the list view.
The edit text has max 3 lines. The problem comes when one line is not enough to hold the text and the edit text grows. It covers part of the list view.
I think I should scroll the list view whenever the edit text grows in dimension but I could not achieve that.
Any ideas on how to tackle this one ?
Set the listview transcriptMode to normal, alternativly alwaysScroll and as pointed out by #andreid remove android:overScrollMode="always".
android:transcriptMode="normal"
or in code:
listView.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_NORMAL);
Try this code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:orientation="vertical" >
<ListView
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:stackFromBottom="true"
android:layout_weight="1" >
</ListView>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/list_divider" />
<LinearLayout
android:id="#+id/sendMsgLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="20dp"
android:orientation="horizontal" >
<EditText
android:id="#+id/messageText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:hint="#string/type_message"
android:maxLines="3" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/imageSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:src="#drawable/send" />
</LinearLayout>
</LinearLayout>
Try this way,hope this will help you to solve your problem.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="2dp"
android:orientation="vertical">
<ListView
android:id="#+id/listview"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:overScrollMode="always"
android:stackFromBottom="true"
android:layout_marginBottom="5dp"/>
<LinearLayout
android:id="#+id/sendMsgLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/messageText"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:hint="#string/type_message"
android:maxLines="3" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/imageSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/send" />
</LinearLayout>
</LinearLayout>

Displaying framelayout one above another

I have a framelayout with id listLayout that contains the button. I want it to be just above the other framelayout with id news_fragment but it is coming besides this.
Here is the xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="#+id/listLayout"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/btn_black_xml"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
<FrameLayout
android:id="#+id/news_fragment"
android:layout_weight="2"
android:layout_width="0dp"
android:layout_height="match_parent">
</FrameLayout>
<FrameLayout
android:id="#+id/channel_fragment"
android:layout_weight="3"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>
You LinearLayout is horizontal, that why child views are shown besides each other. try to put it vertical instead :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
...
I hope I understand well you question.
also be aware that you should simplify your layout : having one single view inside some layouts is useless and resource consuming :
in other word :
<FrameLayout
android:id="#+id/listLayout"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content">
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/btn_black_xml"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
is bad, the FrameLayout is useless.
Take a look if it is what are looking for:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/listLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<FrameLayout
android:id="#+id/news_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
</FrameLayout>
<FrameLayout
android:id="#+id/channel_fragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1" >
</FrameLayout>
</LinearLayout>
</LinearLayout>
Put them both in Linearlayout vertical like so
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/listLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
<Button
android:id="#+id/lists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#drawable/btn_black_xml"
android:padding="8dp"
android:text="List"
android:textColor="#ffffff"
android:textSize="20dp" />
</FrameLayout>
<FrameLayout
android:id="#+id/news_fragment"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" >
</FrameLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/channel_fragment"
android:layout_weight="3"
android:layout_width="0dp"
android:layout_height="match_parent" />
</LinearLayout>

ListView inside tab is not filling height?

I'm using TabHost and inside of one tab, I inserted ListView. I set all height's to fill_parent. But it doesn't show full list, but only part of it. What to do to make tab contents fill screen by height?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bkg"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:layout_marginRight="7dp"
android:layout_marginTop="7dp"
android:background="#drawable/gradientrounded"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:src="#drawable/taxisign" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/taxiprofiletitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_weight="0.9"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
<Button
android:id="#+id/phonenumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="5dp"
android:background="#drawable/button"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:text="Button"
android:textColor="#ffffff" />
</LinearLayout>
<ProgressBar
android:id="#+id/loadFeedbacks"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:visibility="invisible" />
</LinearLayout>
<TabHost
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFF0000" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:background="#FF000000"
android:layout_height="wrap_content" >
<TextView
android:tag="tab0"
android:text="Инфо"
android:background="#android:drawable/btn_star_big_on"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<TextView
android:tag="tab1"
android:text="Отзывы"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<TextView
android:tag="tab2"
android:text="Тарифы"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
<LinearLayout
android:id="#+id/tab1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/profile_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Info" />
</LinearLayout>
<LinearLayout
android:id="#+id/tab2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView android:text="Добавить"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TextView>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<ListView
android:id="#+id/reviewslist"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="#+id/tab3"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="#+id/tariffslist"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" >
</ListView>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
</ScrollView>
On your very first LinearLayout change the layout_height="match_parent". Also, fill_parent has been deprecated since API 8 and replaced with match_parent so that is what you should be using instead.
You have used wrap content for your listView height. You should always use height as match_parent/fill_parent. I guess your problem is here
<ListView
android:id="#+id/reviewslist"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
change it to:
<ListView
android:id="#+id/reviewslist"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
Adding to that, this layout seems to be innefcient. Listviews inside scrollviews are not recommended.
It does seem while quickly viewing the XML file that the parent of your TabHost (LinearLayout) is 'wrap_content' so I am not sure that you are getting all the parents. I do desire a better UI interface for building visuals through Eclipse. Not too happy to work out issues like this when they come up. And they can come up frequently. Usually it involves some trial and error to get things looking the way I want.
Scroll Layout was unnecessary, removing it, made code to work

Categories

Resources