Litho: 一个声明式框架用于在Android上构建高效UI

网友投稿 973 2022-10-31

Litho: 一个声明式框架用于在Android上构建高效UI

Litho: 一个声明式框架用于在Android上构建高效UI

Litho is a declarative framework for building efficient UIs on Android.

Declarative: Litho uses a declarative API to define UI components. You simply describe the layout for your UI based on a set of immutable inputs and the framework takes care of the rest.Asynchronous layout: Litho can measure and layout your UI ahead of time without blocking the UI thread.View flattening: Litho uses Yoga for layout and automatically reduces the number of ViewGroups that your UI contains.Fine-grained recycling: Any component such as a text or image can be recycled and reused anywhere in the UI.

To get started, check out these links:

Learn how to use Litho in your project.Get started with our tutorial.Read more about Litho in our docs.

Installation

Litho can be integrated either in Gradle or Buck projects. Read our Getting Started guide for installation instructions.

Quick start

1. Initialize SoLoader in your Application class.

public class SampleApplication extends Application { @Override public void onCreate() { super.onCreate(); SoLoader.init(this, false); }}

2. Create and display a component in your Activity

@Overridepublic void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ComponentContext context = new ComponentContext(this); final Component component = Text.create(context) .text("Hello World") .textSizeDip(50) .build(); setContentView(LithoView.create(context, component));}

Run sample

You can find more examples in our sample app.

To build and run (on an attached device/emulator) the sample app, execute

$ buck fetch sample$ buck install -r sample

or, if you prefer Gradle,

$ ./gradlew :sample:installDebug

Contributing

For pull requests, please see our CONTRIBUTING guide.

See our issues page for ideas on how to contribute or to let us know of any problems.

Please also read our Coding Style and Code of Conduct before you contribute.

Getting Help

Post on StackOverflow using the #litho tag.Chat with us on Gitter.Join our Facebook Group to stay up-to-date with announcements.Please open GitHub issues only if you suspect a bug in the framework or have a feature request and not for general questions.

License

Litho is BSD-licensed. We also provide an additional patent grant.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:区间合并【简单贪心】acwing803
下一篇:doctest - 最轻的特性丰富的C++单个header的测试框架
相关文章

 发表评论

暂时没有评论,来抢沙发吧~