GithubHelp home page GithubHelp logo

Comments (9)

ditclear avatar ditclear commented on June 1, 2024

StateBinding这个项目时间蛮久了,include 应该算是比较直接的方法,但是写的代码有点多。
现在我对于多状态布局 还是建议 用一个StateLayout为好,里面封装好各种状态,然后只需要根据State显示就好,具体 可以通过 stateLayout.showEmpty()或者通过数据绑定、LiveData来更新

from statebinding.

fanturbo avatar fanturbo commented on June 1, 2024

@ditclear 额,封装好的Statelayout只是在一个将include中所有布局都封装到一个ViewGroup中了,与include并没有什么区别啊,现在你的项目中的include这种方式也是通过数据绑定来展示的各种状态啊

from statebinding.

ditclear avatar ditclear commented on June 1, 2024

封装好的好处就是能直接让组内的其它同事使用,不需要关心细节

from statebinding.

fanturbo avatar fanturbo commented on June 1, 2024

那其实也是需要每个布局中去单独加上的对吗

from statebinding.

ditclear avatar ditclear commented on June 1, 2024

from statebinding.

fanturbo avatar fanturbo commented on June 1, 2024

好的,thanks.

from statebinding.

fanturbo avatar fanturbo commented on June 1, 2024

hello,我发现了一个问题哈,因为我原先也是使用的这种封装好的组合布局(包括空、网络错误或者其他错误),然后在每一个单独的页面单独调用这个组合布局的方法(比如设置空或者错误),但是我发现如果使用GitHubBrowserSample这个demo中的方式(也就是你的这个项目里的方式)的话,虽然在xml中非常的繁琐,但是其实都是简单的复制粘贴,因为使用了databinding,可以把这个处理抽取到网络请求中,不需要每个页面单独去处理了。这样是不是简单些了?额,问下你在实际项目中是如何处理的呢?

from statebinding.

ditclear avatar ditclear commented on June 1, 2024

from statebinding.

fanturbo avatar fanturbo commented on June 1, 2024

好的,thanks

from statebinding.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.