Android 如何在NavigationView的抽屉布局内显示弹出文本视图

Android 如何在NavigationView的抽屉布局内显示弹出文本视图,android,drawerlayout,Android,Drawerlayout,我试着创建一个TextView,它会像Google Hangout appen一样在底部弹出。Google Hangout应用程序在几秒钟内弹出一个弹出窗口,上面写着以xxx身份登录 我有这个经典的导航抽屉布局 <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/

我试着创建一个
TextView
,它会像Google Hangout appen一样在底部弹出。Google Hangout应用程序在几秒钟内弹出一个弹出窗口,上面写着以xxx身份登录

我有这个经典的导航抽屉布局

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="com.port.android.ui.ActivityMain">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <include
            android:id="@+id/toolbar"
            layout="@layout/tool_bar" />

        <FrameLayout
            android:id="@+id/frame"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">
        </FrameLayout>

        <TextView
            android:id="@+id/popup_logged_in"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/PrimaryColor"
            android:layout_alignParentBottom="true"
            android:padding="15dp"
            android:textSize="14sp"
            android:visibility="gone"
            android:gravity="center"
            android:textColor="@android:color/white"
            android:textAllCaps="true"
            android:textStyle="bold" />

    </LinearLayout>

    <android.support.design.widget.NavigationView
        android:id="@+id/navigation_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:headerLayout="@layout/navigation_view_header"
        app:menu="@menu/menu_navigation">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:padding="20dp"
            android:orientation="horizontal">
            <Button
                android:id="@+id/btn_exit"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:onClick="exitAddress"
                android:text="Exit Address"/>

        </LinearLayout>
    </android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>

我想您正在搜索一个小吃吧。。如果这是你正在尝试的,那么这里有一个例子

在要显示此内容的活动中,绑定父布局。假设:
在您的activity.xml中

<android.support.design.widget.CoordinatorLayout     
  xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:id="@+id/cd"
tools:context="com.example.ayyappaboddupalli.dragmaker.MainActivity">
现在,如果要在单击按钮时显示弹出窗口:

    btn.setOnClickListener(new onClickListener()

    public void onClick(View v)
   {
   Snackbar.make(cd,"text you want to show",Snackbar.LENGTH_LONG).show();
    }   
    );

亲爱的,你能发布你的活动吗?谢谢我添加了一些活动代码很棒,我从来都不知道
Snackbar
会在som上尝试。我的想法是,所有系统消息和自定义消息都将进入我的弹出窗口。它全部由
ConcurrentLinkedQueue
线程
控制。基本上我可以输入这样的消息-
showPopup(文本、持续时间、样式)不确定
Snackbar
是否有用,但我会测试是的,我会的,非常快速的回答我喜欢它
    CoordinatorLayout cd=(CoodinatorLayour)findViewById(R.id.cd);
    btn.setOnClickListener(new onClickListener()

    public void onClick(View v)
   {
   Snackbar.make(cd,"text you want to show",Snackbar.LENGTH_LONG).show();
    }   
    );