Coder Social home page Coder Social logo

andyogasample's Introduction

AndYogaSample

Android YOGA Example

详细内容可以查看这篇文章

基于 YOGA的Android工程

YOGA

YOGA主要由两个部分组成,so库和java库

  • so库

有4个so,分别为

libyogacore.so
liblib_fb_fbjni.so
libyoga.so
libgnustl_shared.so
  • so生成
  1. 首先安装buck
  2. 在配置好android ndk的环境
  3. 使用命令 buck build //java:jni#android-armv7,shared 就可以得到你想要的so了,具体命令如下:
  • buck build //java:jni#android-armv7,shared  得到 libyoga.so
  • buck build //yoga#android-armv7,shared 得到 libyogacore.so
  • buck build //lib/fb/fbjni#android-armv7,shared 得到 liblib_fb_fbjni.so
  • java YOGA的java库

init

SoLoader.init(context,false);

使用

YogaNode root = new YogaNode();
root.setWidth(500);
root.setHeight(300);
root.setAlignItems(YogaAlign.CENTER);
root.setJustifyContent(YogaJustify.CENTER);
root.setPadding(YogaEdge.ALL, 20);

YogaNode text = new YogaNode();
text.setWidth(200);
text.setHeight(25);

YogaNode image = new YogaNode();
image.setWidth(50);
image.setHeight(50);
image.setPositionType(YogaPositionType.ABSOLUTE);
image.setPosition(YogaEdge.END, 20);
image.setPosition(YogaEdge.TOP, 20);

root.addChildAt(text, 0);
root.addChildAt(image, 1);

root.calculateLayout();

andyogasample's People

Watchers

 avatar  avatar  avatar

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.