【发布时间】:2016-02-14 17:15:02
【问题描述】:
您好,我在设计时面临一个问题,其 xml 如下。问题是我在嵌套滚动视图中使用了两个文本视图、按钮和回收器视图。当我运行此代码视图时,从 recyclerview 开始,但是当我向下滚动时,那些 textview,button 是可见的。请帮助我如何从第一个视图开始查看,并避免在移动设备内显示视图时直接关注 recyclerview。我怎么解决这个问题?帮我。对不起我的英语不好。
<android.support.v4.widget.NestedScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="false">
<LinearLayout
android:id="@+id/llMainContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="@dimen/padding_10">
<com.xyz.ui.widget.CustomEditTextView
android:id="@+id/etEmail"
style="@style/Widget.xyz.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/order_mobile_number"
android:inputType="text"
app:fontTextStyle="3" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<com.xyz.ui.widget.CustomEditTextView
android:id="@+id/etDateFrom"
style="@style/Widget.xyz.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_normal"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_calendar"
android:drawablePadding="@dimen/spacing_normal"
android:drawableStart="@drawable/ic_calendar"
android:editable="false"
android:focusable="false"
android:hint="@string/date_from"
android:inputType="text"
app:fontTextStyle="3" />
<com.xyz.ui.widget.CustomEditTextView
android:id="@+id/etDateTo"
style="@style/Widget.xyz.EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_left_10"
android:layout_marginStart="@dimen/margin_left_10"
android:layout_marginTop="@dimen/spacing_normal"
android:layout_weight="1"
android:drawableLeft="@drawable/ic_calendar"
android:drawablePadding="@dimen/spacing_normal"
android:drawableStart="@drawable/ic_calendar"
android:editable="false"
android:focusable="false"
android:hint="@string/date_to"
android:inputType="text"
app:fontTextStyle="3" />
</LinearLayout>
<com.xyz.ui.widget.CustomTextView
android:id="@+id/txtGenerate"
style="@style/Theme.xyz.Button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_normal"
android:text="@string/generate_report"
android:textAllCaps="false"
app:fontTextStyle="1" />
<android.support.v7.widget.RecyclerView
android:id="@+id/rvPendingOrders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_micro" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
【问题讨论】:
-
@Schwertfisch 我解决了这个问题。
-
怎么样?我好像也遇到了类似的问题,请问你的解决方法可以吗?
标签: android android-layout android-recyclerview androiddesignsupport android-nestedscrollview