Итак, я хочу показать две кнопки под элементом ViewPager в моем макете.Я не могу видеть ни в симуляторе, ни в макете инспектора.Это мой макет XML настроен.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<Button
android:text="@string/first_crime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/first_button"
android:layout_gravity="bottom"
android:layout_margin="16dp"/>
<Button
android:text="@string/last_crime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/last_button"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"/>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/crime_view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
</android.support.v4.view.ViewPager>
</FrameLayout>
Вот как это выглядит в инструменте дизайна.
Этовторой подход.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/crime_view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
</android.support.v4.view.ViewPager>
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" 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">
<Button
android:id="@+id/first_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/first_crime"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
<Button
android:id="@+id/last_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:text="@string/last_crime"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>
</FrameLayout>
Вот как это выглядит в режиме конструктора.
Я хочу видеть кнопки нанижняя часть экрана в моем симуляторе.вот что я вижу.
Вот скриншот из инспектора макета.
ОБНОВЛЕНИЕ Я обновил макет, используя ConstraintLayout, но я все еще не вижу кнопок в симуляторе.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" 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">
<Button
android:id="@+id/first_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:text="@string/first_crime"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
<Button
android:id="@+id/last_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
android:layout_marginTop="8dp"
android:text="@string/last_crime"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/crime_view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
</android.support.v4.view.ViewPager>
</FrameLayout>
Это макет, показанный внутри элемента ViewPager
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="16dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:listSeparatorTextViewStyle"
android:text="@string/crime_title_label"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/crime_title_hint"
android:id="@+id/crime_title_text"
android:inputType="none"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:listSeparatorTextViewStyle"
android:text="@string/crime_details_label"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:padding="80dp"
android:id="@+id/crime_date_button"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/crime_solved_label"
android:id="@+id/crime_solved"/>
</LinearLayout>
Я изучаю программирование на Android, поэтому, если я исключил любую другую информацию, я был бы рад предоставить эту информацию.