2017-12-05 10 views
-1

ImageViews, TextViews, EditTexts 및 Button과 같은 일부 요소가있는 활동이 있습니다. 모든 것이 정상적으로 보이지만 앱을 실행하면 두 개의 TextView가 보이지 않습니다. 미리보기는 정상이지만 휴대 전화에서 앱을 열면 표시되지 않습니다. 이것은 안드로이드 스튜디오에서 미리보기입니다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" 
       android:orientation="vertical" 
       tools:context="com.construct.v2.activities.auth.PasswordChangeActivity"> 
    <!--<include android:id="@+id/toolbar" layout="@layout/toolbar_simple" />--> 
    <ProgressBar 
    android:id="@+id/progressBar" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="@dimen/mm_margin" 
    android:layout_gravity="center" 
    android:visibility="gone"/> 

    <RelativeLayout 
     android:id="@+id/contentLayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:paddingLeft="24dp" 
     android:paddingRight="24dp" 
     android:paddingTop="80dp"> 
    <ImageView 
     android:id="@+id/change_lock" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/change_pass" 
     android:layout_centerHorizontal="true"/> 

    <TextView 
     android:id="@+id/title" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="20sp" 
     android:fontFamily="sans-serif-medium" 
     android:textStyle="normal" 
     android:textColor="#00596f" 
     android:lineSpacingExtra="2sp" 
     android:layout_centerHorizontal="true" 
     android:layout_below="@id/change_lock" 
     tools:text="@string/change_password" 
     /> 

    <TextView 
     android:id="@+id/subtitle" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="16sp" 
     android:fontFamily="sans-serif" 
     android:textStyle="normal" 
     android:textColor="#555555" 
     android:lineSpacingExtra="4sp" 
     android:layout_below="@+id/title" 
     android:layout_centerHorizontal="true" 
     android:paddingTop="15dp" 
     tools:text="@string/new_password_text" 
     /> 

    <TextView 
     android:id="@+id/fill_password" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/subtitle" 
     android:textColor="@color/construct_red" 
     android:paddingTop="15dp" 
     /> 

    <EditText 
      android:id="@+id/password" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/password" 
      android:textSize="16dp" 
      android:textColorHint="#b1b1b1" 
      android:layout_below="@+id/fill_password" 
      android:backgroundTint="#00596f" 
      android:textColor="#00596f" 
      android:textCursorDrawable="@drawable/color_cursor" 
      android:inputType="textPassword" 
      /> 
    <Button 
     android:id="@+id/saveButton" 
     android:layout_width="220dp" 
     android:layout_height="40dp" 
     android:text="@string/save" 
     android:textSize="14dp" 
     android:gravity="center" 
     android:layout_centerHorizontal="true" 
     android:textColor="#b1b1b1" 
     android:background="#e3e3e3" 
     android:paddingLeft="56dp" 
     android:paddingRight="56dp" 
     android:layout_below="@+id/password" 
     android:layout_marginTop="32dp"/> 
    </RelativeLayout> 
</RelativeLayout> 

:

내 XML 코드

enter image description here

그리고 이것은 내 휴대 전화에서 실행되는 응용 프로그램입니다 :

enter image description here

답변

4

텍스트를 설정하는 중입니다. 에 tools

tools:text="@string/new_password_text" 

변화 :

android:text="@string/new_password_text" 
+0

감사 :

tools:text="@string/new_password_text" 

I로 변경! 문제가 해결되었습니다! –

0

난 그냥 문제를 발견했다. Zeplin을 화면 디자인 도구로 사용하고 있으며 일반적으로 요소에 대한 XML 코드를 생성합니다. 대신에 :

android:text="@string/new_password_text" 
관련 문제