androidshowcaseview

How to change android showcaseview circle position?


I have created showcase view using https://github.com/amlcurran/ShowcaseView library. By default the showcase view circle is pointing to the center of the element. enter image description here

I want to move this circle to the beginning of the TextView

please help me

Updates

My layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.bm.eg.activities.CreateProfileActivity">

     <LinearLayout

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <include layout="@layout/toolbar_transparent" />

                <TextView
                    android:id="@+id/tv_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="8dp"
                    android:layout_marginLeft="40dp"
                    android:layout_marginRight="40dp"
                    android:layout_marginTop="8dp"
                    android:ellipsize="end"
                    android:hint="@string/hint_title"
                    android:singleLine="true"
                    android:textColor="@android:color/white"
                    android:textColorHint="@color/white_transparency_50"
                    android:textSize="24sp" />

in activity

        mTVTitle = (TextView) findViewById(R.id.tv_title);

        mShowcaseView = new ShowcaseView.Builder(this)

                .setTarget(new ViewTarget(mTVTitle))
                .setContentTitle(getString(R.string.sv_create_profile_title))
                .setContentText(getString(R.string.sv_create_profile_title_description))
                .setStyle(R.style.CustomShowcaseTheme2)
                .blockAllTouches()
                .replaceEndButton(R.layout.showcase_view_cusom_button)

                .build();

Solution

  • Finally after researching on your issue i found a solution for you.

    You have to modify your layout design add one more RelativeLayout in your design like below and add two TextViews in it and include your tv_title and hack_txt textview in it like below.

    Note: hack_txt android:hint="aaaaaa" must add 5 or 6 character in it and set android:visibility="invisible".

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.bm.eg.activities.CreateProfileActivity">
    
        <LinearLayout
    
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">
    
            <include layout="@layout/toolbar_transparent" />
    
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="40dp"
                android:layout_marginRight="40dp"
                android:layout_marginTop="8dp">
    
                <TextView
                    android:id="@+id/tv_title"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:hint="@string/hint_title"
                    android:singleLine="true"
                    android:textColor="@android:color/white"
                    android:textColorHint="@color/white_transparency_50"
                    android:textSize="24sp" />
    
                <TextView
                    android:id="@+id/hack_txt"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:ellipsize="end"
                    android:hint="aaaaaa"
                    android:textSize="24sp"
                    android:visibility="invisible" />
            </RelativeLayout>
    
    
    
            <!--... your other view-->
        </LinearLayout>
    </RelativeLayout>
    

    Now update here too

     mTVTitle = (TextView) findViewById(R.id.tv_title);
     mTVHack = (TextView) findViewById(R.id.hack_txt);
    

    Lastly Update here too.

    .setTarget(new ViewTarget(mTVHack))
    

    You are Done happy Coding.

    enter image description here