我试图同时选择从画廊的一些照片,并显示在一个片段recyclerview列表显示一个GridView的刷新。我的布局运行良好,如果我不使用刷卡刷新布局。你能解决这个为什么这个布局不工作,而使用刷卡refreshlayout。拉在滚动视图的Android
XML:
<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="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.systechdigital.webadeal.NewsfeedFragment"
android:orientation="vertical"
android:background="#969696"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#023956"
>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="@drawable/globe"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="@+id/notificationButtonId"
android:background="?android:attr/selectableItemBackground"
android:paddingRight="10dp"
/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:paddingBottom="10dp"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Share you thoughts here..."
android:paddingLeft="10dp"
android:background="@drawable/edittext_status_background"
android:padding="20dp"
android:elevation="5dp"
android:id="@+id/editTextWritePostId"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fitsSystemWindows="true"
android:background="#f9f9f9"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Post"
android:textColor="#ffffff"
android:background="#1470a6"
android:id="@+id/postButtonId"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkInButtonId"
android:layout_toLeftOf="@+id/smileyButtonId"
android:layout_centerInParent="true"
android:src="@drawable/ic_checkin"
android:background="@android:color/transparent"
android:layout_marginRight="3dp"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/smiley"
android:layout_toLeftOf="@+id/imageUploadButtonId"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:id="@+id/smileyButtonId"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/camera"
android:layout_toLeftOf="@+id/videoUploadButtonId"
android:layout_centerInParent="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="10dp"
android:id="@+id/imageUploadButtonId"
/>
</RelativeLayout>
<GridView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/gridViewId"
android:layout_below="@+id/postButtonId"
android:numColumns="auto_fit"
android:columnWidth="100dp"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/underline"
android:minHeight="0dp"
/>
**<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/swipeRefreshLayoutId"
>**
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerviewId_newsFeed"
android:nestedScrollingEnabled="true"
/>
**</android.support.v4.widget.SwipeRefreshLayout>**
</LinearLayout>
</ScrollView>
</LinearLayout>
看到这个【答案】(https://stackoverflow.com/a/36337019/7134908),这将绝对帮助你。 –
无法正常工作。,,。, – AAA
使用NestedScrollView而不是滚动型。 –