2017-01-02 59 views
0

這是我的Activity.xml文件。我把AppCompatEditText放在TextInputLayout裏面。我希望提示能夠在帶有上標文本的html表單中顯示,但它不會發生。所有文本都顯示爲普通文本。有沒有辦法解決?如何在Android中的TextInputLayout中顯示Superscripted提示?我似乎無法弄清楚。這是我的代碼

<android.support.design.widget.TextInputLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="8dp"> 

     <android.support.v7.widget.AppCompatEditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="@string/acceleration_unit_ms2" 
      android:inputType="numberDecimal" 
      android:id="@+id/acceleration_unit_ms2"/> 

    </android.support.design.widget.TextInputLayout> 

的strings.xml

<string name="acceleration_unit_ms2">Meter/Second Square (m/s<sup><small>2</small></sup>)</string> 

回答

0

根據高效的性能使用TextInputEditTextTextInputLayout

<android.support.design.widget.TextInputLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/input_layout_email" 
     android:layout_marginTop="@dimen/dp_10" 
     app:hintEnabled="true" 
     app:hintAnimationEnabled="false"> 

     <android.support.design.widget.TextInputEditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/edit_email" 
      android:inputType="textEmailAddress" 
      android:hint="@string/email" 
      android:textSize="16sp"/> 

</android.support.design.widget.TextInputLayout> 
+0

還沒有上標文字。 –

+0

@ChiranjeevJain編輯了我的答案。現在試試。 –

相關問題