gpt4 book ai didi

android - 损坏的默认背景,例如 EditText 或 TabLayout 和 Toolbar 中的按下状态

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:12:48 24 4
gpt4 key购买 nike

我使用 TabLayout 就像 ViewPager 的标签一样。当我按下某个选项卡时,我得到带有奇怪颜色选项卡的背景。独立于 TabLayout 的 EditText 背景也在奇怪的 View 中。这导致 API 19。而在 API 22 中,所有工作都很完美

aa

当我按下工具栏中的后退按钮时,我有类似的背景,但颜色很奇怪

bb

在我使用 TabLayout 和 Toolbar 的地方有 fragment xml

    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">
</android.support.v7.widget.Toolbar>


<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabGravity="fill"
app:tabIndicatorHeight="0dp"
android:layout_marginBottom="10dp"
/>
</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
android:id="@+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
/>
</android.support.design.widget.CoordinatorLayout>



这是我使用 EditText 的 fragment xml

        <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:text="Заполните поля чтобы войти"
android:textColor="@color/black"/>
<EditText
android:id="@+id/edt_firstname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Логин*"
android:textSize="15sp"
android:textColorHighlight="#F14040"
android:layout_marginTop="10dp"
style="@style/Base"
android:backgroundTint="@color/colorPrimary"
android:inputType="phone"
android:maxLength="13"
/>
<EditText
android:id="@+id/lastname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Пароль"
android:textSize="15sp"
android:textColorHighlight="#F14040"
android:layout_marginTop="10dp"
style="@style/Base"
android:backgroundTint="@color/colorPrimary"
android:inputType="textPassword"
/>



这是我的样式xml

<style name="MyMaterialTheme" parent="MyMaterialTheme.Base">
</style>

<style name="MyMaterialTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="searchViewStyle">@style/SearchViewMy</item>
</style>

<style name="Theme.App.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">#c5c5c5</item>
<item name="colorControlActivated">@color/colorPrimary</item>
<item name="colorControlHighlight">@color/colorPrimary</item>
</style>

在 list 中我设置了

android:theme="@style/MyMaterialTheme"

最佳答案

我能够使用 Android Studio 的 Activity 模板之一在干净的项目上重现该问题。对我来说,问题是 gradle 插件的预览版。您使用的是 Android Studio 2.2 Preview 1 吗?如果是,那么在您的 build.gradle 中找到这一行:

    classpath 'com.android.tools.build:gradle:2.2.0-alpha1'

并将其更改为:

    classpath 'com.android.tools.build:gradle:2.1.0'

对我来说,这解决了问题。

此处报道:https://code.google.com/p/android/issues/detail?id=210312

编辑:修复将在下周的预览版 4 中发布。您需要将该行更改为类路径“com.android.tools.build:gradle:2.2.0-alpha4”。

感谢 mixel 提供指向正确问题的链接以及我粘贴为“编辑:”的信息

关于android - 损坏的默认背景,例如 EditText 或 TabLayout 和 Toolbar 中的按下状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37361076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com