android - In a fragment,when an image is set as the background of a RelativeLayout in ScrollView, the RelativeLayout is misbehaving -
i have activity layout:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".activities.mainactivity" />
then have fragment layout, transacting in fragment_container of activity:
<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <relativelayout android:id="@+id/relative_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/bg_login"> </relativelayout> </scrollview>
the drawable bg_login is: strange thing happening is, background image(bg_login) hides content in relativelayout, in preview pane when run app. can't find out why happening! please help.
i dont know want do, want have multiple background in relative layouts when scrolled or not. assuming you, scroll view when have children element background not best practice. scoll view must set children parent have background practice. may can :
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/bg_login"> <scrollview android:id="@+id/scroll_view" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true"> <relativelayout android:id="@+id/relative_layout" android:layout_width="match_parent" android:layout_height="wrap_content"> </relativelayout> </scrollview> </relativelayout>
Comments
Post a Comment