2016-07-21 4 views
0

https://github.com/amlcurran/ShowcaseView 라이브러리를 사용하여 쇼케이스보기를 만들었습니다. 기본적으로 쇼케이스 뷰 원은 요소의 가운데를 가리 킵니다. enter image description hereandroid showcaseview circle position을 변경하는 방법은 무엇입니까?

나는 텍스트 뷰의 시작 부분이 원을 이동하려는

업데이트

내 레이아웃

<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 = (텍스트 뷰) findViewById를 (R.id.tv_title); .setTarget (새 ViewTarget (mTVTitle)) –

답변

2

마지막으로 귀하의 문제를 조사한 결과 해결책을 찾았습니다.

당신은 수정해야 할 당신의 layout design 설계에서 한 번 더 RelativeLayout 아래와 같이 추가하고있는 TextViews를 추가하고 아래처럼 당신의 tv_titlehack_txt 텍스트 뷰를 포함한다.

참고 :hack_txt 안드로이드 : 힌트 = "AAAAAA"거기에 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 업데이트 된 답변 확인 –

관련 문제