Why doesn't TabHost scroll ???

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Why doesn't TabHost scroll ???

Postby darolla » Wed Nov 05, 2008 9:50 pm

Hi,

I get sick of this. My TabHost doesn't wanna scroll. Please help me on this !!!

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package de.marco;
  3.  
  4.  
  5.  
  6. import android.app.Activity;
  7.  
  8. import android.os.Bundle;
  9.  
  10.  
  11.  
  12. public class FickenActivity extends Activity {
  13.  
  14.         /** Called when the activity is first created. */
  15.  
  16.         @Override
  17.  
  18.         public void onCreate(Bundle savedInstanceState) {
  19.  
  20.                 super.onCreate(savedInstanceState);
  21.  
  22.                 setContentView(R.layout.ficken);
  23.  
  24.         }
  25.  
  26. }
  27.  
  28.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. package de.marco;
  3.  
  4.  
  5.  
  6. import android.app.TabActivity;
  7.  
  8. import android.content.Intent;
  9.  
  10. import android.os.Bundle;
  11.  
  12. import android.widget.TabHost;
  13.  
  14. import android.widget.TabHost.TabSpec;
  15.  
  16.  
  17.  
  18. public class MarcoActivity extends TabActivity {
  19.  
  20.  
  21.  
  22.         @Override
  23.  
  24.         protected void onCreate(Bundle savedInstanceState) {
  25.  
  26.                 super.onCreate(savedInstanceState);
  27.  
  28.  
  29.  
  30.                 final TabHost tabHost = getTabHost();
  31.  
  32.  
  33.  
  34.                 TabSpec ts1 = tabHost.newTabSpec("Börse I");
  35.  
  36.                 ts1.setIndicator("Börse I");
  37.  
  38.                 ts1.setContent(new Intent(this, FickenActivity.class));
  39.  
  40.                 tabHost.addTab(ts1);
  41.  
  42.  
  43.  
  44.                 TabSpec ts2 = tabHost.newTabSpec("Börse II");
  45.  
  46.                 ts2.setIndicator("Börse II");
  47.  
  48.                 ts2.setContent(new Intent(this, FickenActivity.class));
  49.  
  50.                 tabHost.addTab(ts2);
  51.  
  52.  
  53.  
  54.                 TabSpec ts3 = tabHost.newTabSpec("Börse III");
  55.  
  56.                 ts3.setIndicator("Börse III");
  57.  
  58.                 ts3.setContent(new Intent(this, FickenActivity.class));
  59.  
  60.                 tabHost.addTab(ts3);
  61.  
  62.         }
  63.  
  64. }
  65.  
  66.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <resources>
  5.  
  6.         <string name="app_name">Marco</string>
  7.  
  8.         <string name="kram">Keck verhökern diese Knaben\nDinge, die sie gar
  9.  
  10.                 nicht haben,\ntreten selbst den Absturz los,\nden sie brauchen - echt
  11.  
  12.                 famos!\n\nKeck verhökern diese Knaben\nDinge, die sie gar nicht
  13.  
  14.                 haben,\ntreten selbst den Absturz los,\nden sie brauchen - echt famos!
  15.  
  16.         </string>
  17.  
  18.         <string name="dreck">Leichter noch bei solchen Taten\ntun sie
  19.  
  20.                 sich mit Derivaten:\nWenn Papier den Wert frisiert,\nwird die Wirkung
  21.  
  22.                 potenziert.\n\nLeichter noch bei solchen Taten\ntun sie sich mit
  23.  
  24.                 Derivaten:\nWenn Papier den Wert frisiert,\nwird die Wirkung
  25.  
  26.                 potenziert.</string>
  27.  
  28. </resources>
  29.  
  30.  
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1.  
  2. <?xml version="1.0" encoding="utf-8"?>
  3.  
  4. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  5.  
  6.         android:orientation="vertical" android:layout_width="wrap_content"
  7.  
  8.         android:layout_height="wrap_content">
  9.  
  10.  
  11.  
  12.         <TextView android:id="@+id/kram" android:textSize="16px"
  13.  
  14.                 android:layout_width="wrap_content" android:layout_height="wrap_content"
  15.  
  16.                 android:text="@string/kram" android:textColor="#000000"
  17.  
  18.                 android:background="#ffb200" android:padding="10px" />
  19.  
  20.  
  21.  
  22.         <TextView android:id="@+id/dreck" android:textSize="16px"
  23.  
  24.                 android:layout_width="wrap_content" android:layout_height="wrap_content"
  25.  
  26.                 android:text="@string/dreck" android:layout_below="@+id/kram"
  27.  
  28.                 android:textColor="#000000" android:background="#ffc700"
  29.  
  30.                 android:padding="30px" />
  31.  
  32.  
  33.  
  34. </RelativeLayout>
  35.  
  36.  
Parsed in 0.003 seconds, using GeSHi 1.0.8.4


thank u,
DaRolla
Attachments
device.png
TabHost doesn't scroll
device.png (17.09 KiB) Viewed 1449 times
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Top

Postby MrSnowflake » Thu Nov 06, 2008 12:36 am

I think you should put each TextView inside a ScrollViews.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby darolla » Thu Nov 06, 2008 8:55 am

to be honest, this is just a simple example of what I am creating here. I've a custom list with footer table which I wanna place inside the tab. But somehow the custom list scrolls itseld and the table disappears.

so I created an example to get the tab scrolling.

well, maybe scrollview is one solution for this example, but unfortunately not for my true example...

greetings,
DaRolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby darolla » Thu Nov 06, 2008 9:04 am

so lets check all methods of tabHost:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. tabHost.setScrollBarStyle( TabHost.SCROLLBARS_INSIDE_INSET );
  3.  
  4. tabHost.setScrollBarStyle( TabHost.SCROLLBARS_INSIDE_OVERLAY );
  5.  
  6. tabHost.setScrollBarStyle( TabHost.SCROLLBARS_OUTSIDE_INSET );
  7.  
  8. tabHost.setScrollBarStyle( TabHost.SCROLLBARS_OUTSIDE_OVERLAY );
  9.  
  10.  
  11.  
  12. tabHost.setClipChildren( false );
  13.  
  14.  
  15.  
  16. tabHost.setClipToPadding( false );
  17.  
  18.  
  19.  
  20. tabHost.computeScroll();
  21.  
  22.  
  23.  
  24. tabHost.scrollBy( 3, 4 );
  25.  
  26. tabHost.scrollTo( 5, 6 );
  27.  
  28.  
Parsed in 0.035 seconds, using GeSHi 1.0.8.4


they all don't change anything, but I think that tabHost is capable of scrolling itself, without a scrollview for its content.

Greetings,
DaRolla
User avatar
darolla
Master Developer
Master Developer
 
Posts: 273
Joined: Thu Sep 25, 2008 5:16 pm
Location: Dortmund, Germany

Postby MrSnowflake » Fri Feb 20, 2009 2:08 pm

I know this post is old, I just accidently came here by Google. But If you want your TabHost to scroll, when using Intents, then you should implement ScrollView in the hosted Activity, I guess.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests