All Projects → qyxxjd → Multiplestatusview

qyxxjd / Multiplestatusview

Licence: mit
一个支持多种状态的自定义View,可以方便的切换到:加载中视图、错误视图、空数据视图、网络异常视图、内容视图。

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Multiplestatusview

Battery Meter View
🔋 Material design battery meter (i.e. level, state) view for Android
Stars: ✭ 57 (-96.6%)
Mutual labels:  custom-view
Mkloader
Beautiful and smooth custom loading views
Stars: ✭ 1,377 (-17.84%)
Mutual labels:  custom-view
Vusikview
Android library to make notes drop animation for music players
Stars: ✭ 115 (-93.14%)
Mutual labels:  custom-view
Android Circular Progress
Android custom view that loads a circular progress indicator using ImageView or FrameLayout
Stars: ✭ 75 (-95.53%)
Mutual labels:  custom-view
Hhfloatingview
An easy to use and setup floating view for your app. 🎡
Stars: ✭ 93 (-94.45%)
Mutual labels:  custom-view
Timesincetextview
Android TextView for displaying the time since a date
Stars: ✭ 108 (-93.56%)
Mutual labels:  custom-view
Testleavesloading
Android 自定义 View 之 LeavesLoading
Stars: ✭ 55 (-96.72%)
Mutual labels:  custom-view
Flutter mvp
使用Flutter MVP结构开发的短视频类小项目,加入各种平滑的过渡动画。欢迎Star或Fork!
Stars: ✭ 124 (-92.6%)
Mutual labels:  custom-view
Meter Number Picker
The android library that provides a simple and customizable NumberPicker styled as meter.
Stars: ✭ 96 (-94.27%)
Mutual labels:  custom-view
Zhpopupcontroller
Help you pop up custom views easily. and support pop-up animation, layout position, mask effect and gesture interaction etc.
Stars: ✭ 1,481 (-11.63%)
Mutual labels:  custom-view
Easyflipview
💳 A quick and easy flip view through which you can create views with two sides like credit cards, poker cards etc.
Stars: ✭ 1,221 (-27.15%)
Mutual labels:  custom-view
Rapidfloatingactionbutton
Quick solutions for Floating Action Button,RapidFloatingActionButton(RFAB)
Stars: ✭ 1,289 (-23.09%)
Mutual labels:  custom-view
Reel Search Android
Reel Search for Android is a UI/UX design for autocomplete action. It is a beautiful minimalistic addition to any use case.
Stars: ✭ 110 (-93.44%)
Mutual labels:  custom-view
Androidnote
安卓学习笔记
Stars: ✭ 8,486 (+406.32%)
Mutual labels:  custom-view
Springfabmenu
A menu of FloatingActionButton items, designed to be anchored on an AppBarLayout.
Stars: ✭ 116 (-93.08%)
Mutual labels:  custom-view
Croller
A circular seekbar for Android, with a control knob! (for the lack of a better word).
Stars: ✭ 1,088 (-35.08%)
Mutual labels:  custom-view
Consecutivescroller
ConsecutiveScrollerLayout是Android下支持多个滑动布局(RecyclerView、WebView、ScrollView等)和普通控件(TextView、ImageView、LinearLayou、自定义View等)持续连贯滑动的容器,它使所有的子View像一个整体一样连续顺畅滑动。并且支持布局吸顶功能。
Stars: ✭ 1,383 (-17.48%)
Mutual labels:  custom-view
Custom Work For Brackets
<involuntarily lost source code> ____ Adds toolbar it include buttons show/hide with tabs of active documents on the top of the editor.
Stars: ✭ 126 (-92.48%)
Mutual labels:  custom-view
Zjywidget
🎨 一组实用炫酷自定义View的集合(包括源码及demo)包括常见的支付、扫描、解锁动画、炫酷转盘式菜单等效果。A collection of Android cool custom views
Stars: ✭ 121 (-92.78%)
Mutual labels:  custom-view
Wheelview
Android滚动选择控件
Stars: ✭ 1,470 (-12.29%)
Mutual labels:  custom-view

API Library version License

一个支持多种状态的自定义View,可以方便的切换到:

  • 加载中视图
  • 错误视图
  • 空数据视图
  • 网络异常视图
  • 内容视图

apk下载

使用

dependencies {
    implementation 'com.classic.common:multiple-status-view:1.7'
}

示例

<com.classic.common.MultipleStatusView
    android:id="@+id/multiple_status_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:loadingView="@layout/custom_loading_view"
    app:emptyView="@layout/custom_empty_view"
    app:errorView="@layout/custom_error_view"
    app:noNetworkView="@layout/custom_no_network_view"
    app:contentView="@layout/main_content"/>
MultipleStatusView multipleStatusView = (MultipleStatusView) findViewById(R.id.multiple_status_view);

//显示加载中视图
multipleStatusView.showLoading();
// mMultipleStatusView.showLoading("自定义提示内容");
// mMultipleStatusView.showLoading(R.string.custom_hint_content, "占位符1", "占位符2", "...");
// multipleStatusView.showLoading(R.layout.xxx, layoutParams);
// multipleStatusView.showLoading(customView, layoutParams);

//显示空视图
multipleStatusView.showEmpty();
// mMultipleStatusView.showEmpty("自定义提示内容");
// mMultipleStatusView.showEmpty(R.string.custom_hint_content, "占位符1", "占位符2", "...");
// multipleStatusView.showEmpty(R.layout.xxx, layoutParams);
// multipleStatusView.showEmpty(customView, layoutParams);

//显示错误视图
multipleStatusView.showError();
// mMultipleStatusView.showError("自定义提示内容");
// mMultipleStatusView.showError(R.string.custom_hint_content, "占位符1", "占位符2", "...");
// multipleStatusView.showError(R.layout.xxx, layoutParams);
// multipleStatusView.showError(customView, layoutParams);

//显示无网络视图
multipleStatusView.showNoNetwork();
// mMultipleStatusView.showNoNetwork("自定义提示内容");
// mMultipleStatusView.showNoNetwork(R.string.custom_hint_content, "占位符1", "占位符2", "...");
// multipleStatusView.showNoNetwork(R.layout.xxx, layoutParams);
// multipleStatusView.showNoNetwork(customView, layoutParams);

//显示内容视图
multipleStatusView.showContent();
// multipleStatusView.showContent(R.layout.xxx, layoutParams);
// multipleStatusView.showContent(customView, layoutParams);

//设置重试视图点击事件
multipleStatusView.setOnRetryClickListener(onRetryClickListener);

//设置视图状态切换监听事件
mMultipleStatusView.setOnViewStatusChangeListener(OnViewStatusChangeListener);

/**
* 获取当前view的状态
*      MultipleStatusView.STATUS_LOADING   //当前为加载中视图
*      MultipleStatusView.STATUS_EMPTY     //当前为空视图
*      MultipleStatusView.STATUS_ERROR     //当前为错误视图
*      MultipleStatusView.STATUS_NO_NETWORK//当前为无网络视图
*      MultipleStatusView.STATUS_CONTENT   //当前为内容视图
*/
int viewStatus = multipleStatusView.getViewStatus();

MultipleStatusView 继承自 RelativeLayout,所以内容视图也可以直接写在 MultipleStatusView 内部

<com.classic.common.MultipleStatusView
    android:id="@+id/multiple_status_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:emptyView="@layout/custom_empty_view"
    app:errorView="@layout/custom_error_view"
    app:loadingView="@layout/custom_loading_view"
    app:noNetworkView="@layout/custom_no_network_view">

    <ImageView
        android:id="@+id/image"
        android:layout_width="60dp"
        android:layout_height="60dp"
        android:layout_centerVertical="true"
        android:layout_marginLeft="24dp"
        android:layout_marginRight="16dp"
        android:src="@drawable/test"/>

    <TextView
        android:id="@+id/text1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@id/image"
        android:layout_toRightOf="@id/image"
        android:text="内容视图111111"/>

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@id/image"
        android:layout_toRightOf="@id/image"
        android:text="内容视图222222"/>

</com.classic.common.MultipleStatusView>

注意事项

必须按如下规则设置对应视图根节点的 view id,否则会导致试图重叠
必须按如下规则设置对应视图根节点的 view id,否则会导致试图重叠
必须按如下规则设置对应视图根节点的 view id,否则会导致试图重叠

1. 如果使用自定义属性

app:emptyView="@layout/..."
app:errorView="@layout/..."
app:loadingView="@layout/..."
app:noNetworkView="@layout/..."

需要设置:

  • 加载中视图的id必须为:loading_view
  • 空视图的id必须为:empty_view
  • 错误视图的id必须为:error_view
  • 无网络视图的id必须为:no_network_view
  • 自定义提示文本的id必须为:status_hint_content

2. 如果需要点击某个 view 进行重试, 需要设置:

  • 空视图内对应的view id:empty_retry_view
  • 错误视图内对应的view id:error_retry_view
  • 无网络视图内对应的view id:no_network_retry_view

3. 使用 new 关键字创建自定义视图时,请设置 id

TextView tv = new TextView(getApplicationContext());
tv.setId(Utils.generateViewId());
tv.setText(text);

更多使用方法详见 demo 示例:

贡献者

感谢以下人员贡献的代码

关于

License

Copyright 2015 classic

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].