proteus支持GridLayout吗?如果没有,那有什么替代方法? [英] Is GridLayout supported by proteus? If not then what is an alternative?

查看:105
本文介绍了proteus支持GridLayout吗?如果没有,那有什么替代方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试像这样在json中使用GridLayout
{ "type": "GridLayout", "android": "http://schemas.android.com/apk/res/android", "orientation": "horizontal", "layout_width": "match_parent", "layout_height": "match_parent", "columnCount": "2", "rowCount": "2", "children": [ { "type": "TextView", "layout_width": "wrap_content", "layout_height": "wrap_content", "layout_columnWeight": "1", "layout_marginTop": "8dp", "layout_marginLeft": "16dp", "textSize": "20dp", "textColor": "@android:color/background_dark", "text": "244536" }, { "type": "TextView", "layout_width": "wrap_content", "layout_height": "wrap_content", "layout_columnWeight": "1", "layout_marginTop": "8dp", "layout_marginLeft": "16dp", "textSize": "20dp", "textColor": "@android:color/background_dark", "text": "244536" } ] } 准备ProteusView时,我得到的是空值.

I'm trying to use GridLayout in json like this
{ "type": "GridLayout", "android": "http://schemas.android.com/apk/res/android", "orientation": "horizontal", "layout_width": "match_parent", "layout_height": "match_parent", "columnCount": "2", "rowCount": "2", "children": [ { "type": "TextView", "layout_width": "wrap_content", "layout_height": "wrap_content", "layout_columnWeight": "1", "layout_marginTop": "8dp", "layout_marginLeft": "16dp", "textSize": "20dp", "textColor": "@android:color/background_dark", "text": "244536" }, { "type": "TextView", "layout_width": "wrap_content", "layout_height": "wrap_content", "layout_columnWeight": "1", "layout_marginTop": "8dp", "layout_marginLeft": "16dp", "textSize": "20dp", "textColor": "@android:color/background_dark", "text": "244536" } ] } I'm getting null when I am preparing a ProteusView .

如果proteus不支持GridLayout,是否可以使用LinearLayoutRelativeLayout获得相同的结果

If proteus does not support GridLayout, is there a way to use LinearLayout or RelativeLayout to get the same result

推荐答案

Proteus当前没有GridLayout的实现;但是您可以自己实现GridLayout的解析器并使用它.检出名为

Proteus currently does NOT have an implementation for GridLayout; but you can implement the parser for GridLayout yourself and use it. Checkout an example of a custom parser called CircleViewParser and how to register it.

或者,您可以将LinearLayoutlayout_weight一起使用.

Alternatively, you can use LinearLayout with layout_weight.

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal">

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:text="One" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Two" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Three" />

        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:text="Four" />

    </LinearLayout>

</LinearLayout>

这篇关于proteus支持GridLayout吗?如果没有,那有什么替代方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆