1

的风格这些都是我的微调和编辑文本的样子: http://8pic.ir/images/wx0okhe0d0ef1vui2ffh.jpgandroid-如何改变我的编辑文字和微调

这些都是我看见别的地方微调和编辑文本和我喜欢他们: http://8pic.ir/images/3eoc7wazzbormpsv186r.jpg

如何更改我的edittext和spinners以查看第二个图像?

我使用的应用程序紧凑反正

感谢微调风格

+0

http://android-holo-colors.com/ – MilapTank 2014-09-02 12:07:25

回答

0

解决方案: 创建为您的微调自定义布局的自定义适配器。

Spinner spinner = (Spinner) findViewById(R.id.pioedittxt5); 
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, 
     R.array.travelreasons, R.layout.simple_spinner_item); 
adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item); 
spinner.setAdapter(adapter); 
R.layout.simple_spinner_item 

<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/text1" 
    style="@style/spinnerItemStyle" 
    android:singleLine="true" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:ellipsize="marquee" /> 
R.layout.simple_spinner_dropdown_item 

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@android:id/text1" 
    style="@style/spinnerDropDownItemStyle" 
    android:singleLine="true" 
    android:layout_width="match_parent" 
    android:layout_height="?android:attr/dropdownListPreferredItemHeight" 
    android:ellipsize="marquee" /> 
In styles add your custom dimensions and height as per your requirement. 

<style name="spinnerItemStyle" parent="android:Widget.TextView.SpinnerItem"> 

    </style> 

    <style name="spinnerDropDownItemStyle" parent="android:TextAppearance.Widget.TextView.SpinnerItem"> 

    </style> 

here

0

这是你可以使用所有意见的最佳工具,并采取了它的免费

Android的全息色彩生成器允许您轻松地创建Android组件如editext或微调用你自己的颜色为你的Android应用程序。它将生成所有必需的九个修补程序资产以及可以直接复制到项目中的相关XML可绘制和样式。

http://android-holo-colors.com/

尝试

这一形象摆在EditText背景,做作为同为Spinner

注:选择颜色微调此工具

android:background="@drawable/textfield_activated" 

enter image description here

1

为Spinner和EditText设置背景将帮助您弄清楚。

<Spinner android:id="@+id/spinner" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/spinner_bg"/> 

<EditText android:id="@+id/edittext" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/edittext_bg"/> 
</LinearLayout> 
+0

它真的帮助! – mohsen 2014-09-03 04:38:56

1

现在我可以指导你的EditText节..

定义你的风格绘制这样的..

RES /绘制/ edit_text_style.xml

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > 
    <item> 
     <shape > 
      <solid android:color="@color/wine_red" /> 
     </shape> 
    </item> 

    <!-- main color --> 
    <item android:bottom="1.5dp" 
     android:left="1.5dp" 
     android:right="1.5dp"> 
     <shape > 
      <solid android:color="@color/white" /> 
     </shape> 
    </item> 

    <!-- draw another block to cut-off the left and right bars --> 
    <item android:bottom="5.0dp"> 
     <shape > 
      <solid android:color="@color/white" /> 
     </shape> 
    </item> 
    </layer-list> 

现在在你的EditText中像这样定义它..

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="com.example.vivektest.MainActivity" > 

    <TextView 
     android:id="@+id/tv" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/hello_world" /> 

    <EditText 
     android:background="@drawable/edit_text_style" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/et_main" 
     android:imeOptions="actionSearch" 
     android:singleLine="true" 
     /> 

</RelativeLayout> 

希望它有帮助!

相关问题