CustomView overlaps with targetview no option to place CustomView respect to TargetView position and size
amodkanthe opened this issue · comments
amodkanthe commented
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>
amodkanthe commented
updated question title
Faruk Toptaş commented
Here is a sample custom view usage
You can access the focus position to align your views.
amodkanthe commented
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
Faruk Toptaş commented
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.
amodkanthe commented
oh got it thanks will try this