Trying to adapt my view to big and small screens through Scroll View



this is my problem: i'm trying to adapt my view to both big and small screen. as the content doesn't fit a small screen, i thought of using a Scroll View to fix it. it works as i wish on the small screen, but i get an error every time i try to run it on a big screen. my layout code:



<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://ift.tt/nIICcg"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:background="#ffffff" >

<FrameLayout
android:id="@+id/content_frame2"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<com.google.android.gms.ads.AdView
xmlns:ads="http://ift.tt/GEGVYd"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="ca-app-pub-7098126077977688/3494300657"
ads:adSize="BANNER"
android:layout_gravity="center"/>

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >

<ImageView
android:id="@+id/ad_view_photo_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"/>

<TextView
android:id="@+id/ad_view_description"
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center" />

<TextView
android:id="@+id/ad_view_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:padding="5dp"
android:layout_gravity="center" />

<Button
android:id="@+id/ad_view_buy"
android:text="Comprar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center" />

<Button
android:id="@+id/ad_view_back"
android:text="Voltar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center" />

</LinearLayout>

</ScrollView>

</LinearLayout>

</FrameLayout>

<include layout="@layout/drawer"/>

</android.support.v4.widget.DrawerLayout>


and the error:


Activity has leaked window


can anybody give me some help? thanks!


No comments:

Post a Comment