RecyclerView

时间:2016-02-09 19:38:37

标签: android android-recyclerview

我必须使用用户Image和Name创建一个RecyclerView(试图使用RecyclerView实现listView)。我动态地拉动用户。所以我不知道用户数。我必须在Recycler视图中列出用户配置文件图像和用户名的用户。我试过下面的RecyclerView项目布局。但我无法得到完美的观点。它正确调整了ImageView和TextView的宽度,但我无法引入同样固定的行高。此外,我正在尝试修复图像视图的大小。我是否可以在不使用dp的情况下修复图像视图的大小,以便灵活适用于各种屏幕尺寸?

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/user"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <ImageView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:id="@+id/portrait"
        android:layout_marginTop="24dp"
        android:layout_marginBottom="24dp"
        android:layout_marginLeft="24dp"
        android:layout_weight="3" />

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:text="Large Text"
        android:id="@+id/nameLabel"
        android:layout_weight="5"
        android:paddingTop="24dp"
        android:paddingBottom="24dp"
        android:paddingLeft="24dp"
        android:textSize="24sp" />
</LinearLayout>

0 个答案:

没有答案