我正在尝试为我的应用程序编写一般的style.xml。Android:使用一般风格应用边距不起作用
我想我所有的EditText的意见有一定的风格,所以我做了这样的事情:
<!-- Base application theme. -->
<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:editTextStyle">@style/App_EditTextStyle</item>
</style>
<style name="App_EditTextStyle">
<item name="android:background" >#ff0000</item>
<item name="android:textColor">#00ff00</item>
<item name="android:layout_marginLeft">50dip</item>
<item name="android:height">50dip</item>
</style>
在清单我应用的主题:
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyAppTheme" >
这里是样品布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_layout">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/editText"
android:text="Test" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/editText2"
android:text="Test2" />
</LinearLayout>
一切工作正常,除了保证金。出于某种原因,它不适用,我必须手动添加到EditText。我错过了什么吗?
参见[这个答案](http://stackoverflow.com/a/13365288/2052936) – igork