сделать вид перекрывающим все остальные виды в android? - PullRequest
0 голосов
/ 05 апреля 2020

Я хочу добавить эмодзи в стиле Facebook в свое приложение. Я использовал библиотеку под названием emojilike- android. Это работает, но я не вижу всей части обзора. Это идет под текстовым представлением, названным des c. Я попытался принестиToFront (), но не смог этого добиться Как сделать, чтобы emojiView перекрывал все?

emojiView открывается при длинном щелчке мышкой.

my xml file:

<?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> 

1 Ответ

1 голос
/ 05 апреля 2020

Лучше использовать ConstraintLayout. Это более гибко, чем RelativeLayout, тогда как RelativeLayout имеет устаревший виджет.

...