2016-07-21 3 views
0

Я создал витрину с использованием https://github.com/amlcurran/ShowcaseView библиотеки. По умолчанию кружок просмотра витрины указывает на центр элемента. enter image description hereКак изменить положение в андроид-шоу?

Я хочу, чтобы переместить этот круг в начале TextView

пожалуйста, помогите мне

Обновления

Мой макет

<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" /> 

активности

 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(); 
+0

как вы устанавливаете '.setTarget (новый ActionViewTarget (это, ActionViewTarget.Type.HOME))' –

+0

mTVTitle = (TextView) findViewById (R.id.tv_title); .setTarget (новый ViewTarget (mTVTitle)) –

ответ

2

Наконец, после изучения вашей проблемы я нашел решение для вас.

Вы должны изменить ваш layout design добавить еще один RelativeLayout в дизайне, как показано ниже, и добавьте дваTextViews в нем, и включают в свой tv_title и hack_txt TextView в нем, как показано ниже.

Примечание:hack_txt андроида: намек = «аааааа» необходимо добавить 5 или 6 символов в нем и установить 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> 

Теперь обновление здесь

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

Наконец обновление здесь.

.setTarget(new ViewTarget(mTVHack)) 

Вы Готово счастливым Кодирование.

enter image description here

+0

не работает, тот же результат, только центр фокусировки –

+0

@BikeshMAnnur затем добавьте свой макет и код в вопрос. –

+0

@BikeshMAnnur проверить обновленный ответ –