java - Use a static background image for several fragments -
i have problem. when swipe 1 fragment background swipe text, instead of beeing static. how can backround static in fragments. mistake?
activity_main.xml:
>`blockquote` <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/hintergrund"> </android.support.v4.view.viewpager>
one fragment of four(all have same code)
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparenttop="true" android:layout_alignparentright="true" android:layout_alignparentleft="true" android:gravity="center" android:text="test" android:textappearance="?android:attr/textappearancelarge" android:textcolor="#ffdb00" android:textstyle="italic" /> <textview android:id="@+id/textview2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparentleft="true" android:layout_marginbottom="141dp" android:layout_marginleft="18dp" android:text="kollegah; king; omega" android:textappearance="?android:attr/textappearancemedium" android:textcolor="#ffdb00" /> </relativelayout>
new activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <framelayout android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/hintergrund" /> <viewpager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/hintergrund"> /> </framelayout>
you can wrap viewpager in framelayout imageview.
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <imageview android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/hintergrund" /> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent"> </android.support.v4.view.viewpager> </framelayout>
this way viewpager show on top of imageview static.
java android android-fragments background
No comments:
Post a Comment