MiguelD
MiguelD

Reputation: 449

TextInputEditText top of text input cut off android

I have Text Field with some styles applyed to change the background aspect. For some reason the input text when writing is cut off.

One solution i found was to increase the overall height, but i would like to keep the 50dp height

The Text Field:

<com.google.android.material.textfield.TextInputLayout
    android:id="@+id/add_description_layout"
    style="@style/OutlinedRoundedBox"
    android:layout_width="320dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:hint="@string/add_trans_description_title"
    android:layout_marginTop="18dp">

    <com.google.android.material.textfield.TextInputEditText
        android:id="@+id/add_description_input"
        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:inputType="textAutoComplete"
        android:textCursorDrawable="@null" />

</com.google.android.material.textfield.TextInputLayout>

The styles i am using on the text field:

<style name="OutlinedRoundedBox" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
    <item name="shapeAppearanceOverlay">
        @style/ShapeAppearanceOverlay.MyApp.TextInputLayout.Rounded
    </item>
    <item name="boxBackgroundColor">@color/secondaryColor</item>
    <item name="boxStrokeWidth">0dp</item>
    <item name="boxStrokeColor">@color/secondaryDarkColor</item>
    <item name="android:textColorHint">@color/backgroundText</item>
    <item name="android:textColor">@color/backgroundText</item>
    <item name="hintTextColor">@color/backgroundText</item>
    <item name="hintTextAppearance">@style/TextInputLayoutHintText</item>
    <item name="helperTextTextAppearance">@style/TextInputLayoutHelperText</item>
    <item name="android:theme">@style/ThemeOverlay.TextInputEditText.OutlinedBox.CustomFont</item>
</style>

<style name="ThemeOverlay.TextInputEditText.OutlinedBox.CustomFont" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox">
    <item name="editTextStyle">@style/TextInputEditText.OutlinedBox.CustomFont</item>
</style>

<style name="TextInputEditText.OutlinedBox.CustomFont" parent="Widget.MaterialComponents.TextInputEditText.OutlinedBox">
    <item name="android:fontFamily">@font/fira_sans</item>
</style>

<style name="TextInputLayoutHintText" parent="TextAppearance.Design.Hint">
    <item name="android:fontFamily">@font/fira_sans</item>
</style>

<style name="TextInputLayoutHelperText" parent="TextAppearance.Design.HelperText">
    <item name="android:fontFamily">@font/fira_sans</item>
</style>

<style name="ShapeAppearanceOverlay.MyApp.TextInputLayout.Rounded" parent="">
    <item name="cornerFamily">rounded</item>
    <item name="cornerSize">32dp</item>
</style>

Current aspect:

enter image description here

enter image description here

Is there a way around this? Thanks in advance

Upvotes: 1

Views: 1015

Answers (1)

Susan Thapa
Susan Thapa

Reputation: 581

I think this is to be expected. By default android uses 14sp text size and the height you specified might not be enough for the text size. You can try using small text size with attribute android:textSize for TextInputEditText

Upvotes: 1

Related Questions