【问题标题】:Set Divider height in TwoWayView Android Library在 TwoWayView Android 库中设置分隔线高度
【发布时间】:2014-01-06 07:09:35
【问题描述】:

我正在使用http://lucasr.org/2013/02/21/introducing-twowayview/ 水平滚动视图库。

我需要设置项目之间的分隔高度。

<org.lucasr.twowayview.TwoWayView
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/scroller_attached_images"
            style="@style/TwoWayView"
            android:layout_width="fill_parent"
            android:layout_height="200dp"
            android:layout_below="@id/editMessage"
            android:drawSelectorOnTop="false"
            android:focusable="false"
            tools:context=".MainActivity" 
            android:divider="@android:color/transparent"
            android:dividerHeight="10.0sp"/>

这不起作用。谁能帮帮我?

问候, 湿婆

【问题讨论】:

    标签: android android-layout android-listview


    【解决方案1】:

    也许现在为时已晚,但您可以使用 setItemMargin 在代码中执行此操作:

    TwoWayView listView = (TwoWayView) findViewById(R.id.scroller_attached_images);
    listView.setItemMargin(10);
    

    【讨论】:

    • 你知道如何设置分隔线颜色吗?
    【解决方案2】:

    来自示例项目:

    final Drawable divider = getResources().getDrawable(R.drawable.divider);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(divider));
    

    drawables/divider.xml 在哪里:

    <shape xmlns:android="http://schemas.android.com/apk/res/android"
        android:shape="rectangle">
    
        <solid android:color="#cccccc"/>
        <size android:width="2dp"
              android:height="2dp" />
    
    </shape>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-11-19
      • 1970-01-01
      • 1970-01-01
      • 2011-12-22
      • 1970-01-01
      • 2016-09-22
      • 2017-10-31
      相关资源
      最近更新 更多