multi stateView for android
- it contains five state:
- Content
- Loading
- Empty
- Error
- Content_Loading
when you use content_loading state ,you must set contentView buy
app:state_content="@layout/content_view"other than
<com.hqucsx.library.StateView>
<content_view...
</com.hqucsx.library.StateView><com.hqucsx.library.StateView 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/mStateView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:state_current="content"
app:state_empty="@layout/empty_view"
app:state_error="@layout/error_view"
app:state_loading="@layout/loading_view">
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:listitem="@android:layout/simple_list_item_1" />
</com.hqucsx.library.StateView>you can get currentState by
public View getCurrentState()set currentState by
public void setCurrentState(@ViewState int state) get current stateView by
public View getStateView(@ViewState int state) set stateView
public void setViewForState(View stateView, @ViewState int state, boolean switchToState)Attributes
<attr name="state_error" format="reference"/>
<attr name="state_empty" format="reference"/>
<attr name="state_loading" format="reference"/>
<attr name="state_current" format="enum">
<enum name="content" value="0"/>
<enum name="loading" value="1"/>
<enum name="error" value="2"/>
<enum name="empty" value="3"/>
<enum name="content_loading" value="4"/>



