私はスクロールビュー内に線形レイアウトを持っています。 ViewPagerに `android:layout_height =" wrap_content "と指定すると、リテラル値が設定されるまで消えます。どうしてか分かりません? 私のXMLコード:ViewPagerは、ScrollView内にラップすると消滅します
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
.....
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/moto" />
<android.support.v4.view.ViewPager
android:id="@+id/viewshop_pager"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<android.support.v4.view.PagerTabStrip
android:id="@+id/viewshop_pagerStrip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="@color/blueStrip"
android:paddingBottom="5dp"
android:paddingTop="5dp" />
</android.support.v4.view.ViewPager>
</LinearLayout>
ur complete xml? – Raghavendra
いくつかのテキストビューとボタンを削除しても、完全なコードはまだ動作しません –
親と一致するように直線レイアウトの高さを変更し、android:fillViewport = "true"をスクロールビューに追加して試すことができます。 – Raghavendra