I am doing an aplication and I need a tabhost with vertical scrollview in all the tabs, and one of them also need to have a button which bring us to another layout.
The thing is that all the tabwidgets are displayed properly but it doesn't work the scrolling in any of the tabs. And the button doesn´t work at all... I tried to debug and I checked that even the buttons's methon on onclick is never called when I press the button
I am desperate, I need a solution, I've already lost a lot of time here.
This is the most important part of the xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabHost
android:id="@+id/TabHost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/tab5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Logic expression entered:"/>
<TextView
android:id="@+id/textViewE2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/tab4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp"
android:text="Logic expression reduced:"/>
<TextView
android:id="@+id/textViewD2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:layout_marginTop="10dp"
android:layout_marginLeft="30dp" />
<Button
android:id="@+id/buttonD1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="See the esquematic"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
And this is the important code of the Java class
public class Traduccion extends Activity{
String estado_expresionlogica ="A*B*C+A*¬B*C";
TextView tvD2,tvE2;
String sfuncionreducida;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.traduccion);
Resources res =getResources();
TabHost tabs = (TabHost)findViewById(R.id.TabHost);
//Tab 5
tabs.setup();
TabHost.TabSpec spec5 =tabs.newTabSpec("Tab 5");
spec5.setContent(R.id.tab5);
spec5.setIndicator("", res.getDrawable(android.R.drawable.ic_lock_idle_alarm));
//charging the textview needed
this.tvE2=(TextView) findViewById(R.id.textViewE2);
tvE2.setText(estado_expresionlogica);
//Tab 4
tabs.setup();
TabHost.TabSpec spec4 =tabs.newTabSpec("Tab 4");
spec4.setContent(R.id.tab4);
spec4.setIndicator("", res.getDrawable(android.R.drawable.ic_lock_idle_alarm));
//Cargar los textviews que sean necesarios para la pestaña
this.tvD2=(TextView) findViewById(R.id.textViewD2);
////////Here is a code to copy the answer on sfuncionreducida
tvD2.setText(sfuncionreducida);
tabs.addTab(spec5);
tabs.addTab(spec4);
}
public void Esquematico(View v){
Intent i = new Intent (Traduccion.this, ReducidaEsquematico.class);
startActivity(i);
}
}
I wish you can solve at least one of the two problems.. The one with the scrollview or the one with the button!
Thanks a lot.