项目作者: llywuchen

项目描述 :
Android UI layout tools use pure kotlin code like SanpKit in Swift
高级语言: Kotlin
项目地址: git://github.com/llywuchen/SnapKit-Android.git
创建时间: 2019-11-11T07:37:45Z
项目社区:https://github.com/llywuchen/SnapKit-Android

开源协议:MIT License

下载


SnapKit-android

SnapKit-android (https://github.com/Swift-Android/SnapKit-Android) Android UI layout tools use pure kotlin code like SanpKit in Swift.

You can use this to make UI layouts more sample and fast without nasty xml.

It’s easy to use,if you experienced in swfit or Kotlin, you can also see Snapkit in swift

It’s very popular whith more than 10 thousands stars.if you use this tool,nearly we can

code UI once,and then run in IOS an Android.

For the Siwft-Android organization’s Pourpose, write app with swift once ,then run in in IOS an Android.

Use SnapKit-android

Example

Screenshots



  1. name.snp.makeConstraints {
  2. it.leftTo(this).offset(10.dip)
  3. it.topTo(this).offset(50.dip)
  4. it.rightTo(this).offset(-10.dip)
  5. it.heightTo (55.dip)
  6. }
  7. nameX.snp.makeConstraints{
  8. it.topTo(name.snp.bottom).offset(10.dip)
  9. it.heightTo(name).centerXTo(name)
  10. it.widthTo(100.dip)
  11. }
  12. nameY.snp.makeConstraints {
  13. it.heightTo(30.dip).centerYTo(nameX).leftTo(nameX.snp.right).offset(10.dip)
  14. it.widthTo(80.dip)
  15. }
  16. avatar.snp.makeConstraints {
  17. it.centerTo(this)
  18. it.widthTo(50.dip).heightTo(50.dip)
  19. }
  20. scrollView.snp.makeConstraints {
  21. it.leftTo(this).widthTo(this).topTo(avatar.snp.bottom).bottomTo(this)
  22. }

Releases

Our change loghas release history.

The latest release is available on Maven Central.

  1. implementation("com.lly.snp:snapkit-android:0.0.1")

Acknowledgement

Some ideas of the library are drawn from the following projects:

https://github.com/cashapp/contour.git

Special thanks to the above author. If you like the original work, you can use the original project. At the same time, you are welcome to download and experience this project. If you encounter any problems in the process of using it, you are welcome to give feedback.

MIT License

  1. Copyright (c) 2019 swift-android
  2. Permission is hereby granted, free of charge, to any person obtaining a copy
  3. of this software and associated documentation files (the "Software"), to deal
  4. in the Software without restriction, including without limitation the rights
  5. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  6. copies of the Software, and to permit persons to whom the Software is
  7. furnished to do so, subject to the following conditions:
  8. The above copyright notice and this permission notice shall be included in all
  9. copies or substantial portions of the Software.
  10. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  11. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  12. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  13. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  14. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  15. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16. SOFTWARE.