Skip to content

Instantly share code, notes, and snippets.

@fonix232
Created May 9, 2019 09:57
Show Gist options
  • Save fonix232/be0943f79ba330ff86a7ad305195d91d to your computer and use it in GitHub Desktop.
Save fonix232/be0943f79ba330ff86a7ad305195d91d to your computer and use it in GitHub Desktop.
Material library 1.1.0-alpha06 editTextStyle demo
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<size android:width="1dp" />
<solid android:color="?attr/colorAccent" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.38" android:color="?attr/colorOnSurface"/>
<item android:alpha="1.00" android:color="?attr/colorAccent" android:state_focused="true"/>
<item android:alpha="0.87" android:color="?attr/colorOnSurface" android:state_hovered="true"/>
<item android:alpha="0.12" android:color="?attr/colorOnSurface" android:state_enabled="false"/>
</selector>
<resources>
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- primary and secondary colors, OnColors, etc. -->
<item name="editTextStyle">@style/AppTheme.TextInputEditText</item>
<item name="textInputStyle">@style/AppTheme.TextInputLayout</item>
<!-- Custom attribute for testing, defined in attrs.xml -->
<item name="textInputEditTextStyle">@style/AppTheme.TextInputEditText</item>
</style>
<style name="AppTheme.TextInputEditText" parent="Widget.MaterialComponents.TextInputEditText.OutlinedBox">
<item name="android:textCursorDrawable">@drawable/cursor</item>
<item name="android:cursorVisible">true</item>
</style>
<style name="AppTheme.TextInputLayout" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">@dimen/felcana_margin_regular</item>
<item name="android:layout_marginBottom">@dimen/felcana_margin_regular</item>
<item name="android:layout_marginStart">@dimen/felcana_margin_large</item>
<item name="android:layout_marginEnd">@dimen/felcana_margin_large</item>
<item name="hintTextColor">?attr/colorAccent</item>
<item name="boxStrokeColor">@color/outlined_stroke_color</item>
</style>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment