0

我正在尝试使用 ListView 做一个小部件,但我想在右侧真正显示 ScrollBar,没有任何填充。

我希望它像 gmail 日历小部件一样。我将向您展示如何使用图片: 在此处输入图像描述

这是我的布局:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    android:orientation="vertical">
    <FrameLayout android:layout_width="match_parent"
        android:layout_height="wrap_content">
        <TextView
            android:layout_width="match_parent"
            android:id="@+id/widgetTitle"
            android:textColor="@color/colorWhite"
            android:background="@drawable/widget_title_background"
            android:textSize="15dp"
            android:gravity="center"
            android:layout_height="@dimen/widget_title_min_height"></TextView>
    </FrameLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="0dp"
        android:background="@color/colorWhite">
        <ListView
            android:id="@+id/widgetListView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"    
            android:padding="0dp"
            android:clipToPadding="false"
            android:scrollbarStyle="outsideOverlay"
            tools:listitem="@layout/widget_list_item"></ListView>
    </LinearLayout>
</LinearLayout>
4

1 回答 1

0

在 Listview 控件中,滚动条默认始终显示在右侧。试试这个代码..

   <ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/listview"></ListView>
于 2018-04-24T12:59:32.997 回答