小编slo*_*gex的帖子

RecyclerView中的项目没有填充它的宽度match_parent

我和我RecyclerView的子物品有问题.它们不会延伸到整体android:layout_width="match_parent"也不会延伸fill_parent.我试过了两个.问题是,这项工作完美而没有任何变化,它以某种方式毁了.

我在a中显示这个FragmentDialog并且子项仅wrap_content在我上下滚动视图时展开,它们完全展开但是一旦我点击它们(我打电话notifyDataSetChanged())它们就会再次收缩.

这是一张正确填充项目的图片,下面是加载时或者我发送信息时的样子.另外,StickHeaderAdapter我用,不(以前这项工作,我要么改变对部分无)显示头部,直到我点击的项目之一.

recyclerview儿童问题

这是子行的代码:

<?xml version="1.0" encoding="utf-8"?>
<carbon.widget.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    app:carbon_rippleColor="@color/green"
    app:carbon_rippleStyle="background">

<carbon.widget.TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:id="@+id/block_name"
    android:padding="@dimen/block_row_padding"
    android:layout_weight="1"
    android:textSize="@dimen/block_row_text_size"
    android:textColor="@color/black"
    app:carbon_rippleColor="@color/green"
    app:carbon_rippleStyle="background"/>

<RelativeLayout
    android:id="@+id/download_layout"
    android:layout_width="64dp"
    android:layout_height="match_parent"
    android:layout_marginRight="24dp"
    android:layout_marginEnd="24dp"
    android:visibility="gone">


    <carbon.widget.ProgressBar
        android:id="@+id/downloading_bar"
        app:carbon_progressStyle="circular_indeterminate"
        app:carbon_barWidth="5dp"
        app:carbon_tint="@color/green"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_gravity="center"
        android:layout_margin="8dp"
        android:visibility="invisible"/>

    <carbon.widget.TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/block_progress_download"
        android:textSize="12sp"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:visibility="invisible" />

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

这是我创建的适配器代码的一部分ViewHolder:

@Override
public BlockAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = …
Run Code Online (Sandbox Code Playgroud)

android android-recyclerview

18
推荐指数
2
解决办法
6239
查看次数

如何在android中的字符串资源中使用整数资源

如何使用我存储在strings.xml文件中的integers.xml文件中的整数.

例如:

我有<integer name="some_integer">5</integer> ,我想在我的strings.xml文件中使用它:

<string name="some_string">This is my string num @integers/some_integer in a row</string>

显然我的方式不够好所以我需要一点帮助.我相信有一种可能的解决方案我只是不知道正确的解决方案.

感谢所有的帮助!

java xml android android-resources

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