burhanrashid52 / PhotoEditor

A Photo Editor library with simple, easy support for image editing using paints,text,filters,emoji and Sticker like stories.
MIT License
4.17k stars 991 forks source link

Wrap content not working #189

Closed Vitor238 closed 3 years ago

Vitor238 commented 5 years ago

Hi.In my layout the width is getting bigger than the content width. I don't want the emojis and the brush to extend beyond the edges of the photo.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    tools:context=".activity.EditarImageActivity"
    android:orientation="vertical">

    <include layout="@layout/toolbar_empty"
        android:id="@+id/toolbarEditarImagem"/>

    <ja.burhanrashid52.photoeditor.PhotoEditorView
        android:id="@+id/image_preview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/listaBotoes"/>

    <HorizontalScrollView
        android:id="@+id/listaBotoes"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:measureAllChildren="false"
        android:scrollbars="none"
        android:background="@color/colorWindowBackground"
        android:layout_alignParentBottom="true">

        <LinearLayout
            android:padding="10dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <androidx.cardview.widget.CardView
                android:id="@+id/btn_brush"
                app:cardBackgroundColor="@color/colorAccent"
                android:layout_width="80dp"
                android:layout_marginLeft="8dp"
                android:layout_height="80dp">
                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|center_horizontal">
                    <ImageView
                        android:layout_gravity="center_horizontal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                    <TextView
                        android:textAlignment="center"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Pincel"
                        android:textStyle="bold"
                        android:textSize="18sp"
                        android:textColor="@android:color/white"/>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <androidx.cardview.widget.CardView
                android:id="@+id/btn_emoji"
                app:cardBackgroundColor="@color/colorAccent"
                android:layout_width="80dp"
                android:layout_marginLeft="8dp"
                android:layout_height="80dp">
                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|center_horizontal">
                    <ImageView
                        android:layout_gravity="center_horizontal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                    <TextView
                        android:textAlignment="center"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Emoji"
                        android:textStyle="bold"
                        android:textSize="18sp"
                        android:textColor="@android:color/white"/>
                </LinearLayout>
            </androidx.cardview.widget.CardView>

            <androidx.cardview.widget.CardView
                android:id="@+id/btn_text"
                app:cardBackgroundColor="@color/colorAccent"
                android:layout_width="80dp"
                android:layout_marginLeft="8dp"
                android:layout_height="80dp">
                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_vertical|center_horizontal">
                    <ImageView
                        android:layout_gravity="center_horizontal"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" />
                    <TextView
                        android:textAlignment="center"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Texto"
                        android:textStyle="bold"
                        android:textSize="18sp"
                        android:textColor="@android:color/white"/>
                </LinearLayout>
            </androidx.cardview.widget.CardView>
        </LinearLayout>
    </HorizontalScrollView>

</RelativeLayout>

How to fix it? Thanks for this amazing library.

burhanrashid52 commented 3 years ago

Closing due to no activity.