I have a layout xml file which crashes and couldnt understand why. here is my xml, but I am not posting the entire 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="wrap_content"
android:orientation="vertical">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow
android:background="@drawable/gradient"
android:gravity="center">
.......
</TableRow>
</TableLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/sw_layout"
android:orientation="vertical">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#EEEEEE" >
<TableRow
android:id="@+id/tableRowDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
..........
</TableRow>
</TableLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/btn_date"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="@drawable/calendar"
android:text="Tarih" />
<Button
android:id="@+id/btn_converter"
android:layout_height="35dp"
android:padding="5dp"
android:drawableLeft="@drawable/calendar"
android:text="Hesap" />
</LinearLayout>
</ScrollView>
</LinearLayout>
If I remove the last linearlayout. it works perfectly but I need to add button at the bottom of the screen. How can I add the buttons? I want to add the buttons and center them horizontally
Scrollview
will allow only one child, so you have to kept that TableLayout
and LinearLayout
in one more separate layout as child of ScrollView.
Like this
<ScrollView
<LinearLayout
<TableLayout />
<LinearLayout />
</LinearLayout>
</ScrollView>