首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Android中的编辑文本/纺纱器/按钮特殊样式

Android中的编辑文本/纺纱器/按钮特殊样式
EN

Stack Overflow用户
提问于 2014-02-06 13:29:34
回答 1查看 2.3K关注 0票数 0

Dears,

我想实现以下设计:

问题:

  1. 无法为EditText中的提示文本设置填充。

代码:

代码语言:javascript
复制
<EditText
    style="@style/txtBoxStyle"
    android:id="@+id/txtUsername"
    android:drawableLeft="@drawable/ic_username"
    android:hint="@string/text_username">
</EditText>

风格:

代码语言:javascript
复制
<style name="txtBoxStyle">
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">wrap_content</item>
    <item name="android:background">@drawable/edittext_rounded_corners</item>
    <item name="android:paddingLeft">20dp</item>
    <item name="android:ems">10</item>                              
</style>
  1. 不能为左侧的旋转器添加图标。

代码:

代码语言:javascript
复制
<Spinner
    style="@style/ddlStyle"
    android:id="@+id/lstCountry"/>

风格:

代码语言:javascript
复制
<style name="ddlStyle" parent="@android:style/Widget.Spinner">
    <item name="android:layout_width">fill_parent</item>
    <item name="android:background">@android:drawable/ic_country</item>
    <item name="android:layout_height">32dp</item>
    <item name="android:background">@drawable/edittext_rounded_corners</item>
    <item name="android:spinnerMode">dialog</item>
    <item name="android:drawableLeft">@drawable/ic_country</item>
</style>
  1. 无法将按钮内的图像和文本对齐到中心。

请帮帮忙。

EN

回答 1

Stack Overflow用户

发布于 2014-02-06 14:15:37

要在图像和提示文本之间填充,必须使用android属性。

android:drawablePadding="10dp"

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21604383

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档