Showing fragment + viewpager within the same layout; one doesn't show up
-
27-10-2019 - |
문제
Following is my layout file. It works fine except that when I include both foofragment and foo_pager only one of them show show up (based on which one you add first; in the following case only foofragment is displayed but not foo_pager). What am I missing here?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/linearLayout1"
android:layout_column="0"
android:layout_gravity="fill_horizontal"
android:layout_row="0"
android:orientation="vertical" >
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
<fragment class="view.foofragment"
android:id="@+id/foo_frag"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="@+id/foo_pager"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="wrap_content" />
</LinearLayout>
해결책
I played with layout_weight a little bit and now it is fixed. Thanks for looking into it.
제휴하지 않습니다 StackOverflow