0
我是Android的新手,我試圖在Tabbed佈局中使用ScrollView。當我將片段佈局包含到標籤視圖中時,最後一個元素在我們向下滾動時不顯示。我嘗試將「LinearLayout」的高度設置爲「wrap_content」,但仍然不起作用。ScrollView不能在Android中使用Tabbed佈局
理想情況下,我只需要一個按鈕,其他按鈕僅用於測試目的。
如果我將它添加到活動而不是選項卡視圖,相同的佈局工作正常。
這裏是一個包含了滾動型
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scrollbars="vertical"
tools:context="com.adroitminds.tabbedview.Section2">
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="First Name" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Last Name" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="First Name1" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Last Name2" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Phone2" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Email2" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Phone" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Email" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Password" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="16dp"
android:layout_weight="1"
android:hint="Confirm Password" />
<Button
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:text="Submit" />
<Button
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:text="Submit1" />
<Button
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_weight="1"
android:layout_marginBottom="16dp"
android:layout_marginTop="16dp"
android:text="Submit2" />
</LinearLayout>
佈局
分頁活動其中有問題
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
這裏有兩個scenarois截圖
我可以通過降低利潤或EditTexts的大小解決這個問題,但我很想知道我哪裏出了問題。請大家幫我解決這個問題。
我使用最新版本的Android工作室
的minSdkVersion - 18
targetSdkVersion - 23
感謝,
卡皮爾
謝謝你的提示伴侶。除了你的答案,我必須從** android.support.v4.view.ViewPager **中刪除該屬性以及 – wizzardz
很高興我能提供幫助。 :) –