简体   繁体   中英

How to add a “plus” button on top of emptyView in ListView

I'd like to add a Button like this one below into my ListView when the list is empty using the setEmptyView() method.

Is there a built-in style in Android for this? Because I noticed that a few apps are using exactly the same Button style.

Look at this link: Add Items to ListView - Android

It shows the correct Android resource to use, which shows a green "+" symbol on the ImageButton.

To be precise:

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

Short answer: No, this is not a standard Button .

However, you can add a similar Button by using an ImageView . You just have to design/download something you like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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