android一个多状态布局,可以在不同状态之间切换,并带动画效果

描述:

一个多状态布局,可以在不同状态之间切换,并带动画效果

应用截图:

1-1F323051315525

代码介绍:

<com.fingdo.statelayout.StateLayout
        android:id="@+id/state_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <!-- 内容布局 one root view -->
</com.fingdo.statelayout.StateLayout>
<declare-styleable name="StateLayout">
    <!-- error tip image -->
    <attr name="errorImg" format="reference" />
    <!-- error tip text -->
    <attr name="errorText" format="string" />
    <!-- empty tip image -->
    <attr name="emptyImg" format="reference" />
    <!-- empty tip text -->
    <attr name="emptyText" format="string" />
    <!-- no network tip image -->
    <attr name="noNetworkImg" format="reference" />
    <!-- no network tip text -->
    <attr name="noNetworkText" format="string" />
    <!-- timeout tip image -->
    <attr name="timeOutImg" format="reference" />
    <!-- timeout tip text -->
    <attr name="timeOutText" format="string" />
    <!-- sign in tip image -->
    <attr name="loginImg" format="reference" />
    <!-- sign in tip text -->
    <attr name="loginText" format="string" />
    <!-- loading tip text -->
    <attr name="loadingText" format="string" />
</declare-styleable>
<com.fingdo.statelayout.StateLayout
    xmlns:sl="http://schemas.android.com/apk/res-auto"
    android:id="@+id/state_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    sl:emptyImg="@drawable/ic_state_empty"
    sl:emptyText="Empty"
    sl:errorImg="@drawable/ic_state_error"
    sl:errorText="Error"
    sl:loadingText="Loading..."
    sl:loginImg="@drawable/ic_state_login"
    sl:loginText="Sign in"
    sl:noNetworkImg="@drawable/ic_state_no_network"
    sl:noNetworkText="No Network"
    sl:timeOutImg="@drawable/ic_state_time_out"
    sl:timeOutText="Timeout">
</com.fingdo.statelayout.StateLayout>
//StateLayout Constants Type
public static final int ERROR = 1;
public static final int EMPTY = 2;
public static final int TIMEOUT = 3;
public static final int NOT_NETWORK = 4;
public static final int LOADING = 5;
public static final int LOGIN = 6;

源码下载:https://github.com/fingdo/stateLayout

未经允许不得转载:安度博客 » android一个多状态布局,可以在不同状态之间切换,并带动画效果

赞 (0)
分享到:更多 ()

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址