简体   繁体   English

类似于Android L通知的列表对话框(透明ListView分隔符?)

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

I have a dialog containing a dynamic ListView. 我有一个包含动态ListView的对话框。 I'm trying to style it similar to the Android L notifications center but I can't seem to do so. 我正在尝试将其设置为类似于Android L通知中心的样式,但似乎无法这样做。

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. 我的对话框窗口背景已经是透明的,并且已经设置了ListView内容,但是我似乎无法为其添加透明的分隔线。 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. 我唯一的问题是缺少透明的ListView分隔符。

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. 我最终使用嵌入了透明边距的卡片图像来实现这种效果。

我的版式

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

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