Java 让视图覆盖android中的所有其他视图?

Java 让视图覆盖android中的所有其他视图?,java,android,xml,layout,Java,Android,Xml,Layout,我想将类似facebook的表情符号添加到我的应用程序中。我使用了一个叫做emojilike android的库。它可以工作,但我看不到视图的整个部分。它位于一个名为desc的文本视图下。我尝试了bringToFront(),但未能实现。如何让emojiView覆盖所有内容 当长时间单击“喜欢”时,emojiView将打开 我的xml文件: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="ht

我想将类似facebook的表情符号添加到我的应用程序中。我使用了一个叫做emojilike android的库。它可以工作,但我看不到视图的整个部分。它位于一个名为desc的文本视图下。我尝试了bringToFront(),但未能实现。如何让emojiView覆盖所有内容

当长时间单击“喜欢”时,emojiView将打开

我的xml文件:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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="wrap_content">

    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginLeft="0dp"
        android:layout_marginTop="7dp"
        android:layout_marginRight="0dp"
        android:layout_marginBottom="7dp"
        app:cardCornerRadius="0dp"
        app:cardElevation="@dimen/cardview_default_elevation">

        <RelativeLayout
            android:id="@+id/relative1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <ImageView
                android:id="@+id/img"
                android:layout_width="match_parent"
                android:layout_height="fill_parent"
                android:adjustViewBounds="true"
                android:transitionName="img"
                tools:ignore="UnusedAttribute" />

            <ImageView
                android:id="@+id/shadow_bottom"
                android:layout_width="match_parent"
                android:layout_height="80dp"
                android:layout_alignBottom="@id/img"
                android:src="@drawable/bottom_shadow" />

            <ProgressBar
                android:id="@+id/progress_load_photo"
                style="@android:style/Widget.ProgressBar.Small"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_above="@+id/shadow_bottom"
                android:layout_alignParentTop="true"
                android:layout_alignParentEnd="true"
                android:layout_marginTop="251dp"
                android:layout_marginEnd="2dp"
                android:layout_marginBottom="298dp" />

            <TextView
                android:id="@+id/author"
                android:layout_width="match_parent"
                android:layout_height="30dp"
                android:layout_below="@+id/img"
                android:layout_alignStart="@+id/title"
                android:layout_alignLeft="@+id/title"
                android:layout_alignTop="@+id/title"
                android:layout_alignEnd="@id/title"
                android:layout_alignRight="@+id/title"
                android:layout_marginRight="160dp"
                android:drawablePadding="10dp"
                android:ellipsize="end"
                android:gravity="bottom"
                android:maxLines="1"
                android:singleLine="true"
                android:text="Author"
                android:textColor="@android:color/white" />


            <TextView
                android:id="@+id/title"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/img"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="10dp"
                android:layout_marginRight="16dp"
                android:fontFamily="sans-serif-light"
                android:text="Title"
                android:textColor="@color/colorTextTitle"
                android:textSize="17sp"
                android:textStyle="bold" />

            <TextView
                android:id="@+id/desc"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/title"
                android:layout_marginLeft="16dp"
                android:layout_marginTop="5dp"
                android:layout_marginRight="16dp"
                android:text="Desc" />


            <TextView
                android:id="@+id/time"
                android:layout_width="wrap_content"
                android:layout_height="24dp"
                android:layout_below="@+id/desc"
                android:layout_marginTop="10dp"
                android:layout_marginBottom="10dp"
                android:layout_toEndOf="@+id/title"
                android:drawablePadding="10dp"
                android:ellipsize="end"
                android:maxLines="1"
                android:singleLine="true"
                android:text="Time" />  

            <LinearLayout
                android:id="@+id/buttonPanel"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_below="@+id/desc"
                android:orientation="vertical">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:padding="8dp">

                    <ImageView
                        android:id="@+id/like"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:src="@drawable/like" />

                    <ro.andreidobrescu.emojilike.EmojiLikeView
                        android:layout_width="match_parent"
                        android:layout_height="110dp"
                        android:id="@+id/emojiView"
                        android:layout_alignBottom="@+id/like"
                        android:layout_marginBottom="10dp"/>

                    <ImageView
                        android:id="@+id/comment"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_marginStart="10dp"
                        android:layout_toEndOf="@id/like"
                        android:src="@drawable/ic_comment" />

                    <ImageView
                        android:id="@+id/save"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_alignParentEnd="true"
                        android:src="@drawable/ic_savee_black" />

                </RelativeLayout>

                <TextView
                    android:id="@+id/likes"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginStart="8dp"
                    android:textColor="@color/colorPrimaryDark"
                    android:textStyle="bold" />


                <RelativeLayout
                    android:id="@+id/commentsAndDate"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent">

                    <TextView
                        android:id="@+id/comments"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginStart="8dp"
                        android:layout_marginTop="5dp"
                        android:layout_marginBottom="10dp"
                        android:text="@string/view_all_20_comments"
                        android:textColor="@color/colorAccent" />

                    <FrameLayout
                        android:id="@+id/layoutDate"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginStart="8dp"
                        android:layout_marginRight="5dp"
                        android:layout_marginBottom="10dp"
                        android:background="@drawable/round_white"
                        android:padding="5dp">

                        <ImageView
                            android:layout_width="18dp"
                            android:layout_height="18dp"
                            android:layout_marginLeft="5dp"
                            android:layout_marginRight="5dp"
                            android:src="@drawable/ic_date" />

                        <TextView
                            android:id="@+id/publishedAt"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginLeft="27dp"
                            android:layout_marginRight="10dp"
                            android:text="01 January 1990"
                            android:textColor="#606060" />

                    </FrameLayout>

                </RelativeLayout>
            </LinearLayout>

        </RelativeLayout>

    </androidx.cardview.widget.CardView>


</FrameLayout> 


最好使用
ConstraintLayout
。它比
RelativeLayout
更灵活,而
RelativeLayout
有遗留小部件。

迁移
ConstraintLayout
解决了问题。谢谢。