Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android ListView scrollbarStyle在小部件中工作不正常_Android_Listview_Android Widget_Android Scrollbar - Fatal编程技术网

Android ListView scrollbarStyle在小部件中工作不正常

Android ListView scrollbarStyle在小部件中工作不正常,android,listview,android-widget,android-scrollbar,Android,Listview,Android Widget,Android Scrollbar,我正在尝试使用ListView制作一个小部件,但是我想在右边显示滚动条,没有任何填充 我希望它像gmail日历小部件一样。我将向您展示如何使用图片: 这是我的布局: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns

我正在尝试使用ListView制作一个小部件,但是我想在右边显示滚动条,没有任何填充

我希望它像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>

在Listview控件中,滚动条默认值始终显示在右侧。 请尝试此代码

   <ListView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/listview"></ListView>


当您为listview控件提供高度和宽度匹配\u父项时,textview不显示。如果您仅显示listview,则在代码下方使用。是的,在右侧,但在滚动条和小部件边框之间有一点填充。我会编辑这篇文章。