Гость
Форумы / Android [игнор отключен] [закрыт для гостей] / DialogFragment скукоживается / 4 сообщений из 4, страница 1 из 1
02.03.2022, 12:43
    #40137072
vb_sub
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
DialogFragment скукоживается
Всем привет, в приложении есть диалоговое окно(DialogFragment), которое запускается из другого фрагмента (Fragment).
Код: java
1.
2.
3.
 //запуск диалогового окно
   SignOutDialogFragment().show(
            childFragmentManager, "SignOutTag")

Разметка диалога
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingBottom="@dimen/activity_vertical_margin">

    <TextView
        android:id="@+id/textView"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:text="Действительно выйти из программы?"
        android:textSize="32sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

    <Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Отмена"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toStartOf="@+id/button"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Выйти"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.5"
        app:layout_constraintStart_toEndOf="@+id/button2"
        app:layout_constraintTop_toBottomOf="@+id/textView" />

    <androidx.constraintlayout.widget.Guideline
        android:id="@+id/guideline7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintGuide_percent="0.5"
        app:layout_constraintTop_toTopOf="parent" />

</androidx.constraintlayout.widget.ConstraintLayout>


Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
//Диалоговый фрагмент
class SignOutDialogFragment: DialogFragment(), DIAware {
    override val di: DI by closestDI()
    private val _viewModel: SignOutDialogFragmentViewModel by viewModelWithSavedStateHandle()

    private  var _binding: SignoutDialogFragmentBinding? = null
    private val binding get() = _binding!!

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        _binding = SignoutDialogFragmentBinding.inflate(inflater, container, false)

        val view = binding.root
        return view
    }
}


Я хочу, чтобы диалог на весь экран развернулся, но получается как будто в разметке принудительно все отступы убираются.
Подскажите как исправить. Спасибо
...
Рейтинг: 0 / 0
03.03.2022, 10:00
    #40137249
wadman
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
DialogFragment скукоживается
Судя по всему это эмулятор. А на реальном устройстве?
...
Рейтинг: 0 / 0
04.03.2022, 10:09
    #40137508
vb_sub
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
DialogFragment скукоживается
wadman
Судя по всему это эмулятор. А на реальном устройстве?

На реальном устройстве также.
...
Рейтинг: 0 / 0
04.03.2022, 11:45
    #40137532
wadman
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
DialogFragment скукоживается
Пример разметки на экран можно посмотреть тут https://startandroid.ru/ru/uroki/vse-uroki-spiskom/180-urok-110-android-3-fragments-dialogfragment-dialog.html
...
Рейтинг: 0 / 0
Форумы / Android [игнор отключен] [закрыт для гостей] / DialogFragment скукоживается / 4 сообщений из 4, страница 1 из 1
Целевая тема:
Создать новую тему:
Автор:
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]