J'essaie de rendre mon style handicapé Editext comme dans les directives:
https://www.google.com/design /spec/components/text-fields.html#text-fields-labels p> J'ai déjà implémenté des styles de conception de matériaux, tous mes widgets ont l'air matériel . P> La question est la suivante: Mon styles.xml code>: p>
3 Réponses :
afaik, il n'y a pas de "stock". Prenez les directives de conception des matériaux tel qu'il est, une ligne directrice;) p>
Enfin, j'ai fini par une vue personnalisée. Ce n'est peut-être pas la solution la plus élégante, mais cela résout ma tâche.
J'espère que ce sera utile pour quelqu'un. P>
/layout/component_disabled_text.xml strong>: p> /values/attributes_disabled_text_field.xml : /drawable/disabled_text_field_background.xml: /values/styles.xml strud>: p> Exemple d'utilisation forte>: p> <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.kabunov.example.ui.common.DisabledTextField
android:id="@+id/example"
android:layout_width="match_parent"
android:layout_height="wrap_content"
custom:caption="Some caption"
custom:disabledText="Disabled text"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="text_color_disabled_text_view">#61000000</color>
<style name="DisabledTextFieldCaption">
<item name="android:textSize">12sp</item>
<item name="android:textColor">@color/text_color_disabled_text_view</item>
</style>
<style name="DisabledTextFieldValue">
<item name="android:layout_marginTop">3dp</item>
<item name="android:layout_marginBottom">8dp</item>
<item name="android:textSize">16sp</item>
<item name="android:textColor">@color/text_color_disabled_text_view</item>
</style>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:bottom="-1dp"
android:left="-1dp"
android:right="-1dp"
android:top="0dp">
<shape android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/text_color_disabled_text_view"
android:dashGap="2dp"
android:dashWidth="1dp" />
<solid android:color="@android:color/transparent" />
</shape>
</item>
</layer-list>
Enfin, j'ai réussi à faire comme vous l'avez montré, on dirait
Créer en pointillé.xml code> Intérieur
Dossier CODE> Dossier et coller ces P>
<EditText
android:id="@+id/account_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="test account"
android:background="@drawable/dotted"
style="@style/Theme.Main" <!--Its your custom style-->
android:enabled="false" />
Stackoverflow.com/a/8202451/2826147