I am currently having problems with a scrollable view within a tab on an android layout. The view scrolls past underneath the tabs without a scrollable view implemented in the tab layout as shown below.
http://i46.tinypic.com/2ccmp0w.png
When I place a scrollable view within the tabbed layout it shows a small scrollable view that appears buggy and unusable. Shown below.
http://tinypic.com/r/29ej2ft/6
The code for the tab host is below
<?xml version="1.0" encoding="utf-8"?>
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:padding="5dp" />
<TabWidget
android:id="@android:id/tabs"
android:layout_alignParentBottom="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
</TabHost>
and this is the code for the tab with the scroll view implemented
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/todayScroll"
android:layout_height="wrap_content"
android:layout_width="fill_parent" >
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="vertical" >
<ExpandableListView
android:id="@+id/ExpList"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:groupIndicator="@null" />
</LinearLayout>
</ScrollView>
Any ideas of how to get the content to scroll correctly and not get in the way of the tabs would be greatly appreciated :) Thanks.
I've tried a fair few times but it's starting to get very frustrating.
EDIT: Here is the TabHostActivity file.
public class TabbedMainActivity extends TabActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab_main);
TabHost tabHost = getTabHost();
// Tab for todays meals
TabSpec todaysSpec = tabHost.newTabSpec("Todays");
//you could set icon here as well as title
todaysSpec.setIndicator("Todays");
Intent todaysIntent = new Intent(this, TodaysMealsActivity.class);
todaysSpec.setContent(todaysIntent);
// Tab for future meals
TabSpec futureSpec = tabHost.newTabSpec("Future");
futureSpec.setIndicator("Future");
Intent futureIntent = new Intent(this, FutureMealsActivity.class);
futureSpec.setContent(futureIntent);
// Tab for comments
TabSpec commentsSpec = tabHost.newTabSpec("Comments");
commentsSpec.setIndicator("Feedback");
Intent commentsIntent = new Intent(this, CommentsActivity.class);
commentsSpec.setContent(commentsIntent);
// Adding all TabSpec to TabHost
tabHost.addTab(todaysSpec); // Adding todays tab
tabHost.addTab(futureSpec); // Adding future tab
tabHost.addTab(commentsSpec); // Adding comments tab
}
}
Cheers, Rmplanner