我正在使用运动鞋来显示错误消息,并且我正在使用 Viewpager 和视图而不是片段。问题是每当我展示运动鞋错误或我的整个视图变得空白时。我尝试了同样的吐司消息,使用吐司时不会发生此问题。
任何人都可以建议这里可能是什么问题。
我的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:id="@+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<android.support.design.widget.TabLayout
android:id="@+id/leaveFormTab"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<ScrollView
android:id="@+id/primaryScreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<!-- Leave Type -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="1dp">
<Spinner
android:id="@+id/leaveTypeSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/leave_type" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="1">
<!-- From Date -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<TextView
android:id="@+id/fromDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/calender"
android:focusableInTouchMode="false"
android:padding="8dp"
android:textColor="@color/colorBlack"
tools:text="12/10/1994" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/from_date" />
</RelativeLayout>
<!-- To Date -->
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<TextView
android:id="@+id/toDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableEnd="@drawable/calender"
android:focusableInTouchMode="false"
android:padding="8dp"
android:textColor="@color/colorBlack"
tools:text="12/10/1994" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/to_date" />
</RelativeLayout>
</LinearLayout>
<!-- Days Applied -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.9">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<TextView
android:id="@+id/daysApplied"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="8dp"
android:textColor="@color/colorBlack"
tools:text="2" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/no_of_days" />
</RelativeLayout>
<!--Contact on Leave-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.4">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<net.technogen.mocs.view.PrefixEditText
android:id="@+id/contactOnLeave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/level_transparent"
android:inputType="number"
android:maxLength="12"
android:padding="8dp"
android:tag="+"
android:textColor="@color/colorBlack"
android:textSize="13sp"
tools:text="918655431443" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/contact_while_on_leave" />
</RelativeLayout>
</LinearLayout>
<!--Approving Manager-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<TextView
android:id="@+id/approvingManager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="8dp"
android:textColor="@color/colorBlack"
tools:text="PB" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/approving_manager" />
</RelativeLayout>
<!--Reason for Leave-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<EditText
android:id="@+id/reasonForLeave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/level_transparent"
android:gravity="start"
android:minLines="5"
android:padding="8dp"
android:textColor="@color/colorBlack"
android:textSize="13sp"
tools:text="XYZ" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/reason_for_leave" />
</RelativeLayout>
<!--Delegation for Leave-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/border"
android:padding="3dp">
<EditText
android:id="@+id/delegationForLeave"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/level_transparent"
android:gravity="start"
android:minLines="3"
android:padding="8dp"
android:textColor="@color/colorBlack"
android:textSize="13sp"
tools:text="2" />
</LinearLayout>
<TextView
style="@style/ContentHeaderTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:paddingStart="2dp"
android:paddingEnd="2dp"
android:text="@string/delegation_for_leave" />
</RelativeLayout>
<Button
android:id="@+id/submitBtn"
android:layout_width="150dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:background="@color/colorPrimary"
android:elevation="5dp"
android:gravity="center"
android:text="@string/submit"
android:textColor="@color/primary_selector" />
</LinearLayout>
</ScrollView>
<FrameLayout
android:id="@+id/attachmentScreen"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@+id/attachmentList"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<io.github.kobakei.materialfabspeeddial.FabSpeedDial
android:id="@+id/add_voucher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
app:fab_menu="@menu/voucher_menu" />
</FrameLayout>
</android.support.v4.view.ViewPager>
</LinearLayout>
我的运动鞋错误代码:
Sneaker.with(this)
.setMessage("No Internet available, Please check your connection")
.setIcon(R.drawable.ic_no_signal)
.sneak(R.color.colorGray)