小编Nag*_*ori的帖子

RecyclerView 的约束布局存在问题

这是我使用的代码ConstraintLayout

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lokeshlabs.filterableexample.MainActivity">

<android.support.v7.widget.RecyclerView
    android:id="@+id/rv_movie"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"/>

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

这是布局项

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="?attr/listPreferredItemHeight"
    android:layout_margin="4dp"
    android:weightSum="100"
    android:orientation="horizontal">

<TextView
    android:id="@+id/tv_movie_name"
    android:layout_width="0dp"
    android:layout_weight="80"
    android:layout_height="match_parent"
    android:hint="movie name"
    android:textColor="@android:color/black"
    android:textSize="22sp" />


<TextView
    android:id="@+id/tv_year"
    android:layout_width="0dp"
    android:layout_weight="20"
    android:layout_height="match_parent"
    android:hint="year"
    android:padding="8dp"
    android:gravity="end"
    android:textColor="@android:color/black"
    android:textSize="18sp"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我得到的输出

这是我得到的输出

当我将其更改为Linear layoutrelative layout工作正常时

使用线性布局代码

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.lokeshlabs.filterableexample.MainActivity">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/rv_movie"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

这是我使用上面代码时的输出

在此输入图像描述

甚至尝试了里面的所有方法constraintlayout,但没有用,可能是一个错误

android android-constraintlayout

4
推荐指数
1
解决办法
5365
查看次数

如何使用猫鼬从mongodb中选择用户以外的所有用户

我正在尝试从mongo databaseusing 中获取用户mongoose。如果我选择一个用户,我想消除该用户记录并从数据库中获取所有剩余的用户。我怎样才能做到这一点?

mongoose mongodb node.js

1
推荐指数
1
解决办法
1387
查看次数

如何在标题栏中设置一个图标,包括应用程序的名称

如何在标题栏中设置一个图标,包括应用程序的名称

在这里看起来像

但是,我需要在标题中的示例文本之前添加一个图标,请帮助我

<application
    android:allowBackup="true"
    android:label="@string/app_name"
    android:icon="@drawable/coffee_cup"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity"
        android:icon="@drawable/coffee_cup"
        android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".PopUpActivivty"></activity>
</application>
Run Code Online (Sandbox Code Playgroud)

没有用,是否有任何依赖,如果这样告诉我,请

xml android manifest

-1
推荐指数
1
解决办法
1万
查看次数