2017-04-11 158 views
0

我想增加文本大小的提示TextInputLayoutEditText是焦點。但無法弄清楚如何做同樣的事情。增加TextInputLayout的文本大小

<android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="@dimen/component_margin" 
      > 
       <EditText 
        android:id="@+id/firstName" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/prompt_first_name" 
        android:maxLines="1" 
        android:textSize="@dimen/normal_text" 
        android:maxLength="25" 
        android:theme="@style/EditTextTheme" 
        /> 
</android.support.design.widget.TextInputLayout> 

dimens.xml

<dimen name="normal_text">14sp</dimen> 

styles.xml

<style name="EditTextTheme"> 
     <item name="colorControlNormal">@color/colorPrimary</item> 
     <item name="android:labelTextSize">@dimen/input_text_size</item> 
</style> 

我想增加圖像的更大的屏幕裝置上顯示的電子郵件的大小。

enter image description here

同樣的密碼

enter image description here

+0

嘗試XML加入這個'機器人:textAppearance = 「@風格/ Base.TextAppearance.AppCompat.Medium」 ' – Nilabja

+0

與中,大試了這一點。但在輸出中沒有影響。 – Stallion

回答

1

你可以使用默認的hintTextAppearance的TextInputLayout。工作對我罰款

<android.support.design.widget.TextInputLayout 
     android:id="@+id/input_Email" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/ivLogoLogin" 
     app:hintTextAppearance="@style/TextAppearance.AppCompat.Medium"> 
0

添加到您的風格:

<style name="InputTextLabel" parent="TextAppearance.Design.Hint"> 
    <item name="android:textSize">16sp</item> 
</style> 

然後TextInputLayout在你的佈局文件應該是這樣的:

<android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:hintTextAppearance="@style/InputTextLabel" 
      android:minHeight="30dp"> 
+0

試過,但沒有工作。輸出是一樣的。我的活動主題是