Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

New Forums: Nexus Player | Nexus 9
test: Reply
 
LinkBack Thread Tools
Old December 1st, 2012, 03:36 PM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Dec 2012
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default Listview inside a tab..?

So, this is for a normal Activity (min sdk version 7, target sdk version 15):

I have a Listview and a custom made Adapter connected to it.
This Listview is declared in an xml-file together with a TabHost. If the Listview is put directly in the layout and not in a tab, it works perfectly. But if I put it inside one of the tabs, it simply will not show.

Why can't I do this? Do I need to specify something special for the listview or the tabhost, or do I need to call some update/invalidate function on the tabhost after updating the list?

Advertisements
naslundx is offline  
Reply With Quote
sponsored links
Old December 1st, 2012, 03:36 PM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Dec 2012
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is my xml-file:

[HIGH]
<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" >

<!--
IF I PUT THE LISTVIEW HERE, IT WORKS FINE
-->

<TabHost
android:id="@+id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical" >

<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>

<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
android:id="@+id/tformulas"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<Button
android:id="@+id/tformulas_clear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Börja om"
android:visibility="invisible"/>

<!--
THIS IS MY LISTVIEW. IF PUT HERE, IT SIMPLY WILL NOT WORK.
-->

<ListView
android:id="@+id/tformulas_list"
android:layout_width="match_parent"
android:layout_height="match_parent">

</ListView>


</LinearLayout>

<LinearLayout
android:id="@+id/tfavorites"
android:layout_width="match_parent"
android:layout_height="match_parent">

<!-- More stuff -->

</LinearLayout>

<LinearLayout
android:id="@+id/trecent"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical">

<Button
android:id="@+id/trecent_clear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rensa"/>

<!-- More stuff -->

</LinearLayout>

</FrameLayout>
</LinearLayout>
</TabHost>

</RelativeLayout>
[/HIGH]
naslundx is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:51 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.