невидимые предметы в горизонтальном окне - PullRequest
0 голосов
/ 14 ноября 2018

Я использую GridLayoutManager, чтобы показать какое-то изображение в режиме просмотра с горизонтальной ориентацией. Но изображения невидимы в программе. когда я нажимаю на пустое место, оно показывает изображение в другом действии, но они невидимы в представлении реселлера. Я пробовал ВЕРТИКАЛЬ, и они прекрасно и хорошо видны.

вот мой фрагмент xml:

<RelativeLayout>
    <ImageView
        android:id="@+id/imageView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentStart="true"
        android:rotation="180"
        android:scaleType="centerCrop"
        app:srcCompat="@drawable/page_start" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv"
        android:layout_width="match_parent"
        android:visibility="visible"
        android:layout_height="match_parent" />

</RelativeLayout>

фрагмент.java:

RecyclerView rv;
    List<Cards> cardsList;
    Context context;

public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        context = getActivity();
        View rootView = inflater.inflate(R.layout.fragment_cards, container, false);

        readJson readJson = new readJson(context);
        cardsList = readJson.getcardsList();

        rv = rootView.findViewById(R.id.rv);

        rv.setLayoutManager(new GridLayoutManager(context, 3, GridLayoutManager.HORIZONTAL, false));
        rv.setAdapter(new CardsListAdapter(empty, context));

1 Ответ

0 голосов
/ 14 ноября 2018
"rv.setLayoutManager(new GridLayoutManager(context, 3, GridLayoutManager.HORIZONTAL, false));"

используйте ниже строки

rv.setLayoutManager(new GridLayoutManager(context, 3, GridLayoutManager.HORIZONTAL, true));

или

rv.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, true));
...