简体   繁体   中英

List Dialog similar to Android L Notifications (Transparent ListView Divider?)

I have a dialog containing a dynamic ListView. I'm trying to style it similar to the Android L notifications center but I can't seem to do so.

My dialog window background is already transparent and the ListView content is set up but I can't seem to add transparent dividers to it. When I change my listview's divider color to transparent, it completely disappears removing the gap in between. After manually setting a divider height, it returns but it's not transparent. Instead, it's some sort of dark blue-ish transparent color.

My code for this is fairly simple:

    // Create ListView
    ListView mList = new ListView(context);
    mList.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    // Create dialog base
    final Dialog mDialog = new Dialog(context, R.style.TransparentDialog);
    mDialog.setContentView(mList);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.setCancelable(true);

    // Add listview content...
    // ...

    // Apply dividers and content
    mList.setDivider(new ColorDrawable(R.color.transparent));
    mList.setDividerHeight(72);
    mList.setAdapter(mAdapter);

.

How would I go on to styling it like it? My only issue with this is the lack of transparent ListView divider.

This is what I'm trying to achieve: Android L通知

I ended up achieving this effect using card images with transparent margins embedded in them.

我的版式

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