【问题标题】:how to display this notification in Android?如何在 Android 中显示此通知?
【发布时间】:2016-11-14 06:25:46
【问题描述】:

我正在寻找这个库来显示这种通知,当我的列表上有新更新时我可以显示。

这是 Facebook 或 LinkedIn 中的示例。

【问题讨论】:

  • 虽然我没有代码,但你可以在 Framelayout 中尝试这样保持一个 textview 并使用该 textview 切换可见/消失。该文本视图的 onClick 隐藏该 texview 并作为您的 impl 转到底部/顶部。显示最新帖子。

标签: java android ios


【解决方案1】:

您可以使用这个库popup bubble 来满足上述要求

在你的 xml 中

<com.webianks.library.PopupBubble
  android:layout_margin="16dp"
  android:id="@+id/popup_bubble"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:layout_centerHorizontal="true"
/>

在你的活动中

PopupBubble popupBubble = (PopupBubble) findViewById(R.id.popup_bubble);

popupBubble.setPopupBubbleListener(new PopupBubble.PopupBubbleClickListener() {
            @Override
            public void bubbleClicked(Context context) {

                //popup_bubble is clicked  
            }
        });

您也可以将其附加到您的回收站视图

popupBubble.setRecyclerView(recyclerView);

【讨论】:

    【解决方案2】:

    为您的 RecyclerView 设置一个 onScrollListener。在每次滚动时调用您的 API 来获取数据。

    如果添加了新数据,请使用带有 Gone/Visible 淡入/淡出动画的 TextView。这可以通过适配器简单地完成。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-21
      • 1970-01-01
      • 2016-02-04
      • 2011-11-18
      • 2014-11-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多