小编Nit*_*hin的帖子

在ConstraintLayout中向<include>添加约束

请看看我的xml:

<android.support.constraint.ConstraintLayout
    android:id="@+id/constraintLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="?attr/actionBarSize">

    <RelativeLayout
        android:id="@+id/layout_info"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:background="@color/colorPrimaryDark"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"/>

    <include
        layout="@layout/page"
        android:layout_width="match_parent"
        android:layout_height="0dp"/>

</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

我无法添加约束<include>.该app命名空间不起作用(它的工作原理为RelativeLayout)和自动填充不显示约束属性.我希望包含的布局高度是其余的空间ConstraintLayout,但是如何在没有约束的情况下做到这一点!请帮忙.

android android-layout android-constraintlayout

6
推荐指数
2
解决办法
2180
查看次数

字符串数组:'从'i ++'改变的值永远不会被使用'

这是我的代码:

String[] queries = new String[2];
int i = 0;
Boolean result;
queries[i++] = "<query 1>";
queries[i++] = "<query 2>"; //Warning shown here
result = dbOpenHelper.ExecuteMyTransaction(queries);
Run Code Online (Sandbox Code Playgroud)

第二个i++突出显示,并显示警告''i ++'中的值从未使用过'.这段代码被写了另外一个人,据我所知,这里<query 1><query 2>会被分配给queries[1]queries[2]分别,但后来它必须显示一个错误,因为数组的大小为2,没有错误的,善良的这混淆了我对这里发生了什么.我可以安全地删除第二个作业,或将第一个作业更改为queries[i]

java

4
推荐指数
2
解决办法
788
查看次数