Making Money with Android

Integration with startapp, Add position problem

Hi Developers,
Hope you all doing great with apps.

Well i came up with my first android app and about to integrate with some ADD SDK.
I am still not sure which one i will choose. For the sake of integration experience, i am trying to integrate with StartApp SDK.
I have integrated it in the code and Adds are visible on activity page. Whats the Issues ???

Well i spent around more than a day to adjust the position of the add with my SCROLL VIEW and landed nowhere :frowning:

My app uses Scroll view(with Relative layout child’s inside). To show the ADD’s at the Bottom of the Application, i wrapped the Scroll view and another Linear Layout(Containing ADD View) inside Linear Parent. Means i have a Linear Parent with 2 child’s(Scroll View and Linear View) inside.

While testing it on device, it shows only Scroll section, Add section is disappeared :-((

There is no problem with Add SDK, i have tested it without scroll bar. I strongly feel it’s XML level position adjustment.
Please Help.

Following is my activity XML


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <ScrollView
        android:id="@+id/scrollView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:layout_marginBottom="40dp"
        android:fillViewport="true">

        <RelativeLayout
            android:id="@+id/footer2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"            
            android:layout_marginTop="16dp"
            android:paddingLeft="1dp"
            android:paddingRight="1dp" >

            <ImageButton
                android:id="@+id/ImageButton1"/>
            <TextView
                android:id="@+id/TextView1"/>
            <Button
                android:id="@+id/Button1"/>

			<ImageButton
                android:id="@+id/ImageButton1"/>
            <TextView
                android:id="@+id/TextView1"/>
            <Button
                android:id="@+id/Button1"/>
			.
			.
			.				


        </RelativeLayout>
        
    </ScrollView>

    <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@android:drawable/bottom_bar"
            android:gravity="center_vertical">
			
    <!-- Add shit will go here-->

    <com.startapp.android.publish.banner.Banner
        android:id="@+id/startAppBanner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true" />
		
    </LinearLayout>
    		
</LinearLayout>


LinearLayout View below the Scroll view works fine as long as Scroll content is limited to screen size/one page.
But LinearLayout View disappears as Scroll content exceeds the screen size and starts scrolling.

Please help me in this.

@gcc, startapp told me to use relativelayout instead of linearlayout but I never tried it again.

@javaexp, Thanks for your prompt reply.

Well, i did some usefull search on google and got the solution.
Here i am posting it for others(in case if it is helpfull)


<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
        android:background="#5599DD"
        android:layout_height="fill_parent">

        <!-- Header goes here -->
       <TextView 
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            android:layout_marginLeft="10dip"
            android:layout_marginRight="10dip"
            android:layout_marginTop="10dip"
            android:layout_marginBottom="10dip"
            android:textSize="20sp"
            android:layout_gravity="center"
            android:text="Title" />

       <!-- Body goes here -->
        <ScrollView
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <TextView 
                android:id="@+id/text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:autoLink="web"
                android:text="@string/lorem_ipsum"
                android:textColor="#FFFFFF"

                android:padding="10dip" />
        </ScrollView>


        <!-- footer goes here -->
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent">
                <com.startapp.android.publish.banner.Banner
			        android:id="@+id/startAppBanner"
			        android:layout_width="fill_parent"
			        android:layout_height="50dp"
			        android:background="@color/black"
			        android:gravity="center" />

            </RelativeLayout>
     </LinearLayout>

</LinearLayout>

When using linear layouts with multiple children views and having layout problems then use weightsums. These are very useful.

Give your linear layout a weightsum of 10 //the layout is divided into 10 sections, weightsum of 100 = 100 sections

Then give each child view in the layout a weight where all the children’s weights added up equal to 10. i.e. a child’s weight=4 will take up %40 of the linear layout

Then always give the children a layout_width=0dp if your linear layout is horizontal, or layout_height=0dp if vertical //I forget this all the time, very important

Hope this helps