- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我已经放置了一个颜色为白色的编辑文本。但它在 android 4.0 以上的设备上看起来是黑色的,直到 lollipop。
我搜索了这个并得到了将背景颜色应用为白色的解决方案。
但我有另一个布局,编辑文本属于深蓝色,所以如果我将背景颜色应用为白色,整个编辑文本在那个深蓝色布局上看起来是白色的。
我现在可以为此做什么?
布局:
<RelativeLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/purple_bg"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="true"
android:id="@+id/linearLayout"
android:weightSum="1">
<EditText
android:layout_width="match_parent"
android:layout_height="42dp"
android:id="@+id/editTextOrderItem"
android:layout_gravity="center_vertical"
android:backgroundTint="#ffffff"
android:drawableTint="#ffffff"
android:hint="Type here..."
android:textColorHint="#ffffff"
android:paddingLeft="15dp"
android:imeOptions="actionDone"
android:textSize="12sp"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_centerVertical="true"
android:textColor="#ffffff"
android:layout_toLeftOf="@+id/imageViewSearch"
android:layout_toStartOf="@+id/imageViewSearch"
android:singleLine="true" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:id="@+id/imageViewSearch"
android:backgroundTint="@android:color/white"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_gravity="center"
android:src="@drawable/btn_search"
android:layout_centerVertical="true"
android:padding="10dp"
android:layout_marginRight="06dp" />
</RelativeLayout>
颜色.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#ffffff</color>
<color name="colorPrimaryDark">#eeeeee</color>
<color name="colorAccent">#3e3e3e</color>
<color name="black">#747474</color>
<color name="drawerBacground">#e6f7fd</color>
<color name="themetextcolor">#009688</color>
<color name="darktextcolor">#000000</color>
<color name="lighttextcolor">#ACABAC</color>
<color name="activity_bg_color">#D9E7E4</color>
<color name="activity_footer_color">#37b0a0</color>
<color name="btn_text">#b3ffffff</color>
<color name="seperator">#dedede</color>
<color name="accent">#00B0FF</color>
</resources>
请帮忙,谢谢..
编辑:
我尝试添加新主题并将其放入 list 中的 Activity 中,但没有帮助。
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/black</item>
<item name="colorAccent">@color/accent</item>
<item name="android:typeface">monospace</item>
<item name="android:textSize">17sp</item>
</style>
<style name="AppTheme2" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:typeface">monospace</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
<style name="AppTheme1" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:typeface">monospace</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/accent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
list :
<activity android:name=".Activities.MainActivity"
android:theme="@style/AppTheme2"
/>
最佳答案
创建一个drawable
资源xml文件(你的要求只是有一个下划线)
将给定的drawable
设置为editText
的背景然后你可以添加你需要的背景颜色+你需要的底线颜色
解释:
这是一个资源drawable
dashGap
& dashWidth
用于点线/虚线(如果您不需要需要破折号,请将其移除)
android:top
-> 您可以为您不需要的views
设置minus尺寸显示。(这里您的要求是仅显示底线,因此项目的顶部、右侧和左侧行已给出 -2dp )
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#FFF" /> <-- background color here
</shape>
</item>
<item android:top="-2dp" android:right="-2dp" android:left="-2dp">
<shape>
<solid android:color="@android:color/transparent" />
<stroke
android:dashGap="10px"
android:dashWidth="10px"
android:width="1dp"
android:color="#ababb2" <-- bottom line color here />
</shape>
</item>
</layer-list>
关于java - 编辑文本底线在 android 4.1 中看起来是黑色的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41217429/
一直在使用Vim多年来,一直以来我都接受了bright and distracting the visual bell曾是。最近有人给我看Emacs visual bell ,它只闪烁屏幕的顶行和底行
如何删除 UITableViewController 中的 UISearchBar 底线? 也可以应用 Swift 解决方案。 这是我的 VC 代码: NavigationController.Nav
我有一个 Activity ,我在其中将数据 bundle 到另一个 Activity 。有了这些数据,我还 bundle 了一个自定义颜色,我希望在 Activity 2 中显示 EditText
我有一个应用有时需要其导航栏才能与内容融为一体。 有谁知道如何摆脱这个烦人的小酒吧或改变它的颜色? 在下图的情况下,我说的是“ Root View Controller ”下方的 1px 高度线 最佳
如何删除DataRepeater控件中数据控件项的底部边框线: 最佳答案 您在 DataRepeater 中看到的分隔符项目之间的控制,是非客户区的绘图DataRepeaterItem控制。 你可以找
.segment-button-indicator { -ms-flex-item-align: end; align-self: flex-end;
我是一名优秀的程序员,十分优秀!