Recyclerview в DialogFragment

Вы пытались сначала инициализировать модель просмотра, а затем передать ее в представление?

public View2(View2ViewModel vm)
{
    InitializeComponent();
    Messenger.Default.Register<NotificationMessage<int>>(this, (m) => NotificationMesageReceived(m, m.Content));
}
private void NotificationMesageReceived(NotificationMessage<int> msg, int divisionIdnt)
{
    if (msg.Notification == "SearchCred")
    {
        var vm = new View2ViewModel();
        vm.DivisionIdnt = divisionIdnt;
        var findCredentialView = new View2(vm); 
        findCredentialView.ShowDialog();
    }
}
0
задан halfer 25 January 2019 в 23:27
поделиться

6 ответов

Я думаю, что установка android:layout_height="match_parent" на ConstraintLayout решит вашу проблему.

0
ответ дан Charan M 25 January 2019 в 23:27
поделиться

использовать этот макет

<?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"
android:background="@drawable/roundable_bg">

<android.support.v7.widget.RecyclerView
    android:id="@+id/wv_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/bt_ok"
    android:background="@android:color/white"
    />

<TextView
    android:id="@+id/bt_ok"
    android:layout_width="200dp"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="16dp"
    android:layout_marginBottom="8dp"
    android:padding="12dp"
    android:layout_alignParentBottom="true"
    android:textStyle="bold"
    android:background="@drawable/button_selector"
    android:gravity="center"
    android:textColor="@android:color/black"
    android:text="@string/ok" />
    </RelativeLayout>
0
ответ дан user1214083 25 January 2019 в 23:27
поделиться

В вашем Recyclerview

установить

android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"

удалить

app:layout_constraintHeight_max="350dp"
android:maxHeight="350dp"
0
ответ дан Ketan Ramani 25 January 2019 в 23:27
поделиться

Это простое изменение заставляет его работать.

<androidx.recyclerview.widget.RecyclerView
    android:id="@+id/recyclerViewFolderList"
    android:layout_width="0dp"
    android:layout_height="0dp"
    app:layout_constraintHeight_default="wrap"
    app:layout_constraintBottom_toTopOf="@+id/imgViewClose2"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView1" />

Спасибо всем, кто пытался мне помочь.

0
ответ дан Gunaseelan 25 January 2019 в 23:27
поделиться

У меня была эта проблема. В конце концов я отказался от использования ConstraintLayout здесь и вернулся к RelativeLayout - легко и сработало как шарм.

ConstraintLayout - это здорово, но иногда лучшим решением является старая школа.

0
ответ дан Luke 25 January 2019 в 23:27
поделиться

попробуйте использовать minWidth, minHeight и maxWidth, maxHeight в корневом макете диалога.

0
ответ дан SinaMN75 25 January 2019 в 23:27
поделиться
Другие вопросы по тегам:

Похожие вопросы: