相关疑难解决方法(0)

如何更改EditText的颜色/外观选择句柄/锚点?

所以我用Holo Colors GeneratorAction Bar Style Generator将Holo Theme的风格改为我自己的颜色.但是当我在编辑文本中选择文本时,所选位置的"标记"仍为蓝色.我该怎么改变它?

剩下中间对

android android-theme android-edittext

18
推荐指数
4
解决办法
1万
查看次数

EditText光标和指针颜色为android 5.0以下

我试图更改EditText光标指针颜色(从原色蓝色到白色),但没有解决方案适用于我的项目.我试图开发演示项目,其中相同的代码工作正常.这段代码适用于> = android 5.0

我不知道,我的值会覆盖哪个属性.我有两个选项可以解决这个问题: -
1.找到控制该颜色值的属性.
2.页面加载时(在onViewCreated中)通过java代码更改颜色值.

请建议如何解决此问题.

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="my_text_layout_style">

        <item name="android:textColor">#FFF</item>
        <item name="android:textColorHint">#FFF</item>

        <item name="colorAccent">#FFF</item>
        <item name="colorControlNormal">#FFF</item>
        <item name="colorControlActivated">#FFF</item>

        <item name="colorControlHighlight">#FFF</item>

    </style>



    <style name="my_edit_text_style">
        <item name="colorAccent">#FFF</item>
        <item name="android:editTextStyle">@style/MyEditTextStyle</item>
    </style>

    <style name="MyEditTextStyle" parent="Widget.AppCompat.EditText" />
</resources>
Run Code Online (Sandbox Code Playgroud)

layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:background="@color/base_disable_btn_bg_color"
    android:orientation="vertical">

    <android.support.design.widget.TextInputLayout
        android:layout_width="match_parent"
        android:hint="just a hint"
        app:hintTextAppearance="@style/my_text_layout_style"
        android:theme="@style/my_text_layout_style"
        android:layout_height="wrap_content">

        <android.support.design.widget.TextInputEditText
            android:layout_width="match_parent"
            android:theme="@style/my_edit_text_style"
            android:layout_height="wrap_content" />

    </android.support.design.widget.TextInputLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

试图以编程方式添加视图但没有成功

AppLinearLayout appLinearLayout = (AppLinearLayout) view.findViewById(R.id.some_id);
EditText editText = new EditText(new ContextThemeWrapper(getContext(), …
Run Code Online (Sandbox Code Playgroud)

android android-edittext android-textinputedittext

10
推荐指数
1
解决办法
1566
查看次数

如何更改 edittext 文本选择手柄的颜色?

我知道这个问题已经得到解答,但我找不到有效的解决方案。

在 android > lolipop (21) 上,他们有什么方法可以改变我的文本选择手柄的颜色(无需上传新的 png 图像)?

我定义了这种风格

<?xml version="1.0" encoding="utf-8"?>
<resources>

  <style name="AppEditTextStyle" parent="@android:style/Widget.Material.Light.EditText">
    <item name="android:background">@null</item>    
    <item name="android:textCursorDrawable">@null</item> 
    <item name="android:drawableTint">#00ffffff</item>           
  </style>

  <style name="AppTheme" parent="@android:style/Theme.Material.Light.NoActionBar"> 
    <item name="android:editTextStyle">@style/AppEditTextStyle</item>
  </style>

</resources>
Run Code Online (Sandbox Code Playgroud)

但这不起作用,我收到:错误:找不到与给定名称匹配的资源:attr 'android:drawableTint'。

但在文档(https://developer.android.com/reference/android/widget/TextView.html#attr_android:drawableTint)中明确指出 android:drawableTint 存在:(所以我不明白为什么我错过了?

android android-theme android-edittext android-styles

5
推荐指数
1
解决办法
5849
查看次数

EditText - 以编程方式更改文本选择背景颜色

我正在研究适用于 Android 应用程序概念的动态主题。我正在以编程方式为所有 UI 应用主题颜色。我想以EditText编程方式更改选择背景颜色。在此处输入图片说明

任何帮助将非常感激。我想更改文本选择突出显示颜色。

user-interface android android-theme android-edittext android-view

5
推荐指数
1
解决办法
2264
查看次数

如何更改EditText的textSelectHandle颜色

Android有一个默认的绿色泪滴,显示在文本下方以帮助选择文本或位置.如何在没有@drawables 的情况下改变它的颜色?我尝试过, android:textSelectHandle="@color/colorPrimary"但只是让它消失了.

<EditText
  android:inputType="text"
  android:layout_width="fill_parent"
  android:layout_height="match_parent"
  android:layout_toEndOf="@+id/imgMagnifyingGlass"
  android:textAlignment="viewStart"
  android:backgroundTint="@color/colorWhite"
  android:textCursorDrawable="@null"
  android:textSelectHandle="@color/colorPrimary"
  android:textColor="@color/colorGray"
  android:id="@+id/editTextWord" />
Run Code Online (Sandbox Code Playgroud)

android

4
推荐指数
1
解决办法
1537
查看次数