litho

A declarative framework for building efficient UIs on Android.

  • 所有者: facebook/litho
  • 平台:
  • 許可證: Apache License 2.0
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Litho CircleCI Bintray Join the chat at https://gitter.im/facebook/litho

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:

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

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final ComponentContext c = new ComponentContext(this);

    final Component component = Text.create(c)
        .text("Hello World")
        .textSizeDip(50)
        .build();

    setContentView(LithoView.create(c, 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

Before contributing to Litho, please first read the Code of
Conduct
that we expect
project participants to adhere to.

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 licensed under the Apache 2.0 License.

主要指標

概覽
名稱與所有者facebook/litho
主編程語言Kotlin
編程語言Java (語言數: 10)
平台
許可證Apache License 2.0
所有者活动
創建於2017-01-27 03:59:11
推送於2025-05-05 18:25:29
最后一次提交2025-05-05 11:13:57
發布數363
最新版本名稱v2025.05.05 (發布於 2025-05-05 00:03:16)
第一版名稱v0.1.0 (發布於 )
用户参与
星數7.7k
關注者數182
派生數762
提交數19.1k
已啟用問題?
問題數394
打開的問題數56
拉請求數51
打開的拉請求數44
關閉的拉請求數496
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?