В первом fragmentA
есть RecyclerView
. Если щелкнуть элемент RecyclerView, fragmentA
заменен на fragmentB
. В первый раз, когда открытый фрагмент А работает правильно. Поэтому, когда я нажимаю элемент RecyclerView, fragmentA
заменен на fragmentB
, но fragmentB
не прокручивается. Затем, когда я вернулся (по BackStack) до fragmentA
, я нашел его также не прокручиваемым, хотя он был прокручиваемым перед заменой fragmentB
. fragmentB
также имеет RecyclerView в горизонтальной стадии. Я не понимаю, в чем проблема. Любая идея, совет, помощь будут важны для меня. БлагодаряПосле фрагмента заменить фрагмент не прокручиваемый
MainActivity
где я замена фрагментов слушателю
@Override
public void onObjectItemClicked(Fragment fragment) {
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN).replace(R.id.flContent, fragment).addToBackStack(null).commit();
fragmentManager.executePendingTransactions();
}
расположение MainActivity
<RelativeLayout
android:layout_marginTop="?android:attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/flContent"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
Fragmenta раскладка
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:visibility="gone"
android:id="@+id/mapFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/objects_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</RelativeLayout>
FragmentB макет
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/object_img_rl"
android:layout_width="match_parent"
android:layout_height="220dp"
>
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/object_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:scaleType="centerCrop" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/dark_gradient"
/>
<RelativeLayout
android:visibility="gone"
android:id="@+id/aksia_img"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/image_aksia" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:rotation="270"
android:text="@string/aksia"
android:textColor="@color/colorWhite" />
</RelativeLayout>
<ImageView
android:visibility="gone"
android:id="@+id/imgHalal"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
app:srcCompat="@drawable/halal" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:ellipsize="end"
android:maxLines="1"
android:text="Ағайын"
android:textColor="@color/colorWhite"
android:textSize="19sp" />
<LinearLayout
android:id="@+id/time_ll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/title"
android:layout_centerInParent="true"
android:layout_marginTop="8dp"
android:orientation="horizontal">
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_gravity="center"
android:src="@drawable/ic_green_circle" />
<TextView
android:id="@+id/work_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:ellipsize="end"
android:maxLines="1"
android:text="мкр Айнабулак 4, дом 1"
android:textColor="@color/colorWhite"
android:textSize="12sp" />
</LinearLayout>
<TextView
android:id="@+id/price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/time_ll"
android:layout_centerInParent="true"
android:layout_gravity="end"
android:layout_marginTop="5dp"
android:maxLines="1"
android:text="мкр Айнабулак 4, дом 1"
android:textColor="@color/colorWhite"
android:textSize="12sp" />
<TextView
android:layout_marginTop="30dp"
android:id="@+id/object_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/colorWhite"
android:textSize="15sp"
android:layout_alignParentTop="true"
android:layout_centerInParent="true" />
</RelativeLayout>
<RelativeLayout
android:visibility="gone"
android:id="@+id/conOval"
android:layout_width="65dp"
android:layout_height="65dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="180dp"
android:background="@drawable/oval_fragment_detail">
<TextView
android:id="@+id/rating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:gravity="center"
android:text="5/5"
android:textColor="@color/colorAccent"
android:textSize="25sp" />
</RelativeLayout>
<LinearLayout
android:id="@+id/blok_one"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/object_img_rl"
android:layout_marginEnd="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginStart="15dp"
android:layout_marginTop="35dp"
android:orientation="vertical">
<TextView
android:id="@+id/description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/fragment_detail_text_color"
android:textSize="15sp" />
<android.support.v7.widget.RecyclerView
android:visibility="gone"
android:layout_gravity="center_horizontal"
android:id="@+id/kitchen_recycler_view"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginTop="20dp"
android:background="#fff" />
<android.support.v7.widget.RecyclerView
android:visibility="gone"
android:layout_gravity="center_horizontal"
android:id="@+id/service_recycler_view"
android:layout_width="wrap_content"
android:layout_height="70dp"
android:layout_marginTop="20dp"
android:background="#fff" />
<LinearLayout
android:visibility="gone"
android:id="@+id/con_aksia"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@drawable/lynear_layout_border"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/aksia"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/aksia"
android:textColor="@color/fragment_detail_text_color"
android:textSize="13sp" />
<TextView
android:id="@+id/aksia_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="Акция контент"
android:textColor="@color/fragment_detail_text_color"
android:textSize="12sp" />
</LinearLayout>
<Button
android:id="@+id/use_aksia"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:background="@color/colorAccent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="@string/use_aksia"
android:textColor="@color/colorWhite"
android:textSize="14sp" />
</LinearLayout>
<TextView
android:id="@+id/phone1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textColor="#4A90E2"
android:textSize="14sp" />
<TextView
android:id="@+id/phone2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textColor="#4A90E2"
android:textSize="14sp" />
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textColor="#4A90E2"
android:textSize="14sp" />
<TextView
android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textColor="@color/fragment_detail_text_color"
android:textSize="14sp" />
<TextView
android:id="@+id/work_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:textColor="@color/fragment_detail_text_color"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/blok_two"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_below="@+id/blok_one"
android:layout_marginTop="25dp"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/colorWhite">
<Button
android:id="@+id/btnMenu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/button_border"
android:text="@string/menu"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@color/colorWhite">
<Button
android:id="@+id/btnBron"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/button_border"
android:text="@string/bron"
android:textAllCaps="false"
android:textColor="#000000"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/blok_three"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/blok_two"
android:background="#F5F4F4"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<ImageButton
android:id="@+id/imgInsta"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#F5F4F4"
/>
<ImageButton
android:id="@+id/imgWapp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#F5F4F4"
/>
<ImageButton
android:id="@+id/imgFb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#F5F4F4"
/>
<ImageButton
android:id="@+id/imgVk"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#F5F4F4"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/blok_four"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/blok_three"
android:layout_margin="25dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/gallery"
android:textColor="@color/fragment_detail_text_color"
android:textSize="14sp" />
<android.support.v7.widget.RecyclerView
android:clickable="true"
android:focusable="true"
android:background="?android:attr/selectableItemBackground"
android:layout_marginTop="10dp"
android:id="@+id/gallery_recycler_view"
android:layout_width="match_parent"
android:layout_height="160dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="170dp"
android:orientation="vertical"
android:layout_below="@+id/blok_four"
android:layout_marginBottom="25dp">
</LinearLayout>
<LinearLayout
android:background="#FFFFFF"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/comment_block"
android:orientation="vertical"
android:padding="25dp"
android:layout_below="@+id/map"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/comments"
android:textColor="@color/fragment_detail_text_color"
android:textSize="14sp" />
<android.support.v7.widget.RecyclerView
android:layout_marginTop="10dp"
android:id="@+id/comment_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnShowAllComments"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/show_all_comments"
android:textAllCaps="false"
android:layout_gravity="center_horizontal"
android:textColor="#4A90E2"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:theme="@style/buttonTransparentStyle"
style="?android:attr/borderlessButtonStyle"
/>
<Button
android:id="@+id/btnAddComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_selector_custom"
android:theme="@style/buttonTransparentStyle"
android:text="@string/add_comments"
android:textAllCaps="false"
android:textSize="16sp"
android:textColor="#4A90E2"
android:layout_gravity="center_horizontal"
android:paddingLeft="40dp"
android:paddingRight="40dp"
android:layout_marginTop="10dp"
/>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
поместить все вашу коду Java, пожалуйста, –
пожалуйста, вы можете поставить снимок экрана до и после ввода фрагмента б –
@jiteshmohite нет – eluuu