faruktoptas / FancyShowCaseView

An easy-to-use customisable show case view with circular reveal animation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CustomView overlaps with targetview no option to place CustomView respect to TargetView position and size

amodkanthe opened this issue · comments

Need option to align cutom view with respect to TargetView like above or below TargetView

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <LinearLayout
        android:layout_centerInParent="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:id="@+id/tvTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginBottom="16dp"
            android:fontFamily="@font/proximanova_regular"
            android:textColor="@color/space_white"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/tvSubTitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:fontFamily="@font/proximanova_regular"
            android:textColor="@color/space_white"
            android:textSize="18sp" />
    </LinearLayout>

</RelativeLayout>

image

updated question title

Here is a sample custom view usage

val params = image.layoutParams as RelativeLayout.LayoutParams
.

You can access the focus position to align your views.

yeah already checked that I want to set custom view on left/right side of target view or top/bottom is that possible was able to see layout params only

If you click the link you can see the code below:

val image = (view as RelativeLayout).findViewById<ImageView>(R.id.iv_custom_view)
                            val params = image.layoutParams as RelativeLayout.LayoutParams

                            image.post {
                                params.leftMargin = mFancyShowCaseView!!.focusCenterX - image.width / 2
                                params.topMargin = mFancyShowCaseView!!.focusCenterY - mFancyShowCaseView!!.focusHeight - image.height
                                image.layoutParams = params
                            }

focusCenterX, focusCenterY, focusHeight and focusWidth parameters can be used.

oh got it thanks will try this