【问题标题】:How to add a "plus" button on top of emptyView in ListView如何在 ListView 中的 emptyView 顶部添加“加号”按钮
【发布时间】:2011-08-03 15:29:33
【问题描述】:

当列表为空时,我想使用setEmptyView() 方法将下面这样的Button 添加到我的ListView 中。

Android 中是否为此提供了内置样式?因为我注意到一些应用程序使用完全相同的Button 样式。

【问题讨论】:

  • 那是自定义按钮,标准界面不提供该样式。

标签: android listview button


【解决方案1】:

看这个链接:Add Items to ListView - Android

它显示要使用的正确 Android 资源,在 ImageButton 上显示一个绿色的“+”符号。

准确地说:

<ImageButton
    android:id="@+id/moreImageButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"

    android:contentDescription="@string/image_button_delete"
    android:src="@android:drawable/ic_input_add" />

【讨论】:

    【解决方案2】:

    简答:不,这不是标准的Button

    但是,您可以使用ImageView 添加类似的Button。你只需要设计/下载你喜欢的东西。

    【讨论】:

      猜你喜欢
      • 2020-10-10
      • 2021-05-17
      • 2017-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-25
      • 2016-09-01
      • 1970-01-01
      相关资源
      最近更新 更多