简体   繁体   English

ListView scrollbarStyle在窗口小部件中无法正常工作

[英]ListView scrollbarStyle not working properly in a Widget

I'm trying to do a Widget with a ListView, but I want to show the ScrollBar really in the right side, without any padding. 我正在尝试使用ListView做一个Widget,但是我想真正在右侧显示ScrollBar,而没有任何填充。

I want it like the gmail calendar Widget. 我想要它像gmail日历小部件。 I will show you how with pictures: 我将向您展示如何使用图片: 在此处输入图片说明

This is my Layout: 这是我的布局:

<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>

In Listview control scrollbar default show on right side always. 在Listview控件中,滚动条默认始终显示在右侧。 Try This code .. 试试这个代码..

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM