This is my xml file. There are 35 xml files like this in my app. Their textview and button numbers are different. Some of them are more than 10 , some of are less than 5. But considering the devices screen, i designed all xml files using scroll view. Also i needed tablelayout and used tablelayout, table row inside it and textviews inside tablerows. When i finished the app everything was ok. Now i added mobile ad banners in xml files and it started to crash.
If i add the banner just before ending of tablelayout , app doesnt crash and ad is displayed at teh end of table but the vision is too bad.Because if there are 3 rows in the xml then the banner takes place after the last textview and this is something like the middle of the page. No matter how many textviews the xml use, i want them to be scrollable and in the end i want the banner take place at the end of the page.
I tried some android:gravity="bottom" or
alignparentbottom="true" things but they didn't work. In my researches i realised that i may need to add some linear or relative layout codes but when i tried them thay dont fit with scrollview and crash. Here is one of the xml files. How should i need to modify this ?
In the images , First one is how it works , the banner takes place where the textview ends , i want the second image , no matter how long the tetviews the banner should be at the bottom of the page.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/blue">
<TableLayout
android:id="@+id/table"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:padding="5dp"
android:text="TRY"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" >
</TextView>
// some other buttons or textviews...
</TableRow>
</TableLayout>
<com.startapp.android.publish.banner.Banner
android:id="@+id/startAppBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
</ScrollView>
If the banner needs to be always shown at the bottom, you can set the weight of the ScrollView in a LinearLayout to 1.
Example
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/blue">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="@drawable/blue">
<TableLayout
android:id="@+id/table"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:padding="5dp"
android:text="TRY"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFFFFF" >
</TextView>
// some other buttons or textviews...
</TableRow>
</TableLayout>
</ScrollView>
<com.startapp.android.publish.banner.Banner
android:id="@+id/startAppBanner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>