Исправлена кнопка, которая остается, даже когда viewPager проведен
У меня есть кнопка закрытия [x] в двух моих xml (с плавающей темой диалога), с которой я использую viewPager.
Кнопка закрытия находится в верхнем правом углу двух xml. Тем не менее, когда я проведу пальцем влево или вправо, кнопка тоже будет перемещаться туда-сюда, что выглядит действительно странно. Любая идея, чтобы кнопка оставалась фиксированной, даже когда я пролистываю страницы?
Код с одной страницы (обе страницы похожи):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="350dp"
android:minHeight="700dp"
android:background="#CECECE"
android:id="@+id/dialogLayout"
android:orientation="vertical">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lblInfo"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-6dp"
android:text="Information"
android:textStyle="bold"
android:textColor="#000"
android:textSize="40dp" />
<ImageButton
android:id="@+id/btnClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="320dp"
android:layout_marginTop="-4dp"
android:layout_marginRight="-4dp"
android:background="#0000"
android:src="@drawable/close" />
</TableRow>
<TextView
android:id="@+id/lblInfo"
android:layout_width="wrap_content"
android:layout_height="400dp"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:textColor="#000"
android:textSize="17dp" />
</LinearLayout>
ViewPager xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="612dp"
android:layout_height="700dp">
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>