-1
I put a ScrollView
in one of my layouts
, to allow users with smaller screens to view all information.
The problem is that when I start the application on my mobile phone (5.5') I see a white band above the layout
:
The code xml
of layout
is as follows:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:overScrollMode="ifContentScrolls"
android:fillViewport="true"
>
<RelativeLayout
android:id="@+id/activity_main_apresentation"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorBackGround">
<ImageView
android:id="@+id/imagetoMain"
android:layout_width="wrap_content"
android:layout_height="400dp"
android:contentDescription="ola"
android:src="@drawable/cakelogomain"
/>
<TextView
android:id="@+id/txttoDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/imagetoMain"
android:layout_centerHorizontal="true"
android:text="@string/description"
android:textColor="@color/colorSecondBackGround"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/texttoViewTodscr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/txttoDescription"
android:gravity="center_horizontal"
android:text="@string/descriptionTwo"
android:textColor="@color/colorSecondBackGround"
android:textSize="10sp" />
<Button
android:id="@+id/idButton"
android:layout_width="350dp"
android:layout_height="wrap_content"
android:layout_below="@id/texttoViewTodscr"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="@color/colorSecondBackGround"
android:text="@string/botaoMainTransition"
android:textColor="@color/colorWhite" />
</RelativeLayout>
</ScrollView>
Can someone give me an explanation of why this happened?
Some better way to adapt mine layouts
to smaller screens?
Thank you Leonardo! It worked, a small detail that completely passed me by! This is the best way to present on small screens, or know another? :)
– ZelDias
I believe it’s the best way, the match_parent will cause the screen to adapt to the user’s screen both in width and height, and putting the scroll bar only when necessary, if someone opens with a 6 inch device, it may be that the scroll bar does not even appear
– Leonardo Dias
Thanks for the help Leonardo! :)
– ZelDias