标签: android-theme

Holo快速滚动看旧设备上

关于我的应用

我有一个具有全息外观的应用程序.

对于pre-Honeycomb设备,我只是向后推出了Holo主题的一些元素.

使用主题,样式和attrs适用于CheckBox,RadioButton ......

我想做什么

我使用ListView来显示很多项目.我想在我的ListView上启用快速滚动,我希望它具有全息外观.

我的问题

我有一些困难将快速滚动Drawable它集成到我的应用主题中.

到目前为止我尝试过的

  1. 寻找能够做到这一点的图书馆. HoloEverywhere很有希望,但没有处理.

  2. 试图自己做:

我刚刚添加了那些drawable:

在此输入图像描述 在此输入图像描述

然后还添加了这个drawable:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/fastscroll_thumb_pressed_holo" />
    <item android:drawable="@drawable/fastscroll_thumb_default_holo" />
</selector>
Run Code Online (Sandbox Code Playgroud)

在我的添加中attrs.xml:

<attr name="fastScrollThumbDrawable" format="reference" />
Run Code Online (Sandbox Code Playgroud)

我在我的中添加了这个themes.xml:

<style name="MyTheme">
    <item name="fastScrollThumbDrawable">@drawable/fastscroll_thumb_holo</item>
</style>
Run Code Online (Sandbox Code Playgroud)

此主题已正确设置为我的应用程序Manifest.xml:

android:theme="@style/MyTheme"
Run Code Online (Sandbox Code Playgroud)

请记住android:fastScrollThumbDrawable 蜂窝前不存在.


我希望你能帮我解决这个问题.:)

更新:

几个小时前,HoloEverywhere已经添加了快速滚动支持:

https://github.com/ChristopheVersieux/HoloEverywhere/commit/34561e48339bf6a3e0307d2d35fc4c5ac8409310

我会检查一下.:)

android android-layout fastscroll android-theme android-holo-everywhere

8
推荐指数
1
解决办法
1860
查看次数

主题的可绘制问题

在构建我的应用程序时,我开始使用Theme.Light.NoTitleBar.Fullscreen主题.我为这样的整个应用程序构建了所有布局,并让我看到了我想要的东西.布局中使用的一些drawable的大小是专门设置的,而其他的则设置为wrap_content.

然后我决定切换到Holo灯光主题.当我这样做时,设置为wrap_content的布局中使用的所有drawable最终都会变大.几乎就像他们从一个更大的水桶中拉出来一样.事实上,有些人看起来已经被拉长了.

基于Holo的主题

默认的PreHolo主题

我知道旧主题中的背景是黑色的,但这不是问题(这实际上是包含在另一个布局中的布局文件).显然两者之间的规模差异很大.

android android-theme android-drawable

8
推荐指数
1
解决办法
403
查看次数

Android:AccountPicker设置Light Theme

是否可以设置选择器对话框的主题?

import com.google.android.gms.common.AccountPicker;
....
String[] accountTypes = new String[]{"com.google"};
Intent intent = AccountPicker.newChooseAccountIntent(null, null,
                accountTypes, false, null, null, null, null);
activity.startActivityForResult(intent, REQUEST_CODE_PICK_ACCOUNT);
Run Code Online (Sandbox Code Playgroud)

我的基本应用主题是android:Theme.Light但对话框很暗.谢谢.

android android-theme google-authenticator android-authenticator google-play-services

8
推荐指数
1
解决办法
1222
查看次数

如何获取当前主题的操作栏背景颜色?

我试图让导航抽屉的背景始终与动作栏的背景颜色相匹配.

所以,每次,如果主题改变,两个背景都会自动改变.

我看着R.attr,但没有找到任何东西.

android background-color android-theme android-actionbar

8
推荐指数
1
解决办法
5561
查看次数

更改应用启动窗口的颜色

当应用程序启动时,我想改变一下闪烁的颜色.我认为这是由总体应用程序主题决定的,但我想指定另一种颜色.

详细说明,我不想修改所有活动的默认背景颜色,由下式指定:

<item name="android:windowBackground">@color/red</item>
Run Code Online (Sandbox Code Playgroud)

实现这一目标的最优雅方式是什么?

谢谢你的时间!

android colors startup android-theme

8
推荐指数
2
解决办法
2571
查看次数

Android 5.0:如何更改概述屏幕任务标题背景颜色

新的Android 5.0 Lollipop 概述屏幕为每个应用程序的任务提供屏幕截图和(默认情况下)灰色标题栏.

一些Lollipop应用程序(例如新的Play商店)使用不同的颜色.如何更改概览屏幕标题背景的颜色?

Android概述屏幕,知识共享署名2.5

android android-theme android-5.0-lollipop

8
推荐指数
1
解决办法
4057
查看次数

Android - Action Bar未显示使用Theme.AppCompat

我正在尝试使用Theme.AppCompat,但是当我做动作栏时,它就会消失.没有错误或任何错误.

问题是我在另外两个项目上使用了这个确切的设置,它们工作正常,不确定发生了什么变化.

我还尝试更改支持库版本,父主题,清理项目,重建和使缓存无效.不知道是否有任何帮助,但无论如何我都做了.

我使用的是Android Studio 0.8.14

如果我错了,请纠正我,但这就是我在旧API上使用Material Theme小部件和调色板的方式,对吧?

预习

在此输入图像描述


styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

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

AndroidManifest.xml中

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".ActivityLogin"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
Run Code Online (Sandbox Code Playgroud)

的build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' …
Run Code Online (Sandbox Code Playgroud)

android android-theme android-actionbar

8
推荐指数
1
解决办法
7560
查看次数

PlacePicker没有拾取材质主题

我正在使用Google Play服务中的PlacePicker库来启动新活动.新活动/选择器有一个工具栏(操作栏),默认情况下没有设置样式.

PlacePicker文档说明了这一点

如果使用材质主题在应用程序中设置自定义颜色,则场所选择器将从主题继承colorPrimary和colorPrimaryDark属性.

我的style.xml文件中有一个主题:

<style name="AppTheme" parent="Theme.AppCompat.Light">
    <item name="colorPrimary">#5665bb</item>
    <item name="android:colorPrimary">#5665bb</item>
    <item name="colorPrimaryDark">#41456b</item>
    <item name="android:colorPrimaryDark">#41456b</item>
</style>
Run Code Online (Sandbox Code Playgroud)

我已经设置了在Android Manifesto文件中使用的主题

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
Run Code Online (Sandbox Code Playgroud)

placepicker由以下代码创建:

try {
    PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
    Intent intent = intentBuilder.build(Main.this);
    // Start the intent by requesting a result,
    // identified by a request code.
    startActivityForResult(intent, REQUEST_PLACE_PICKER);
} catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) {
    Log.e("", "Error with Google Play lib.");
}
Run Code Online (Sandbox Code Playgroud)

但是,工具栏不会设置样式.和以前一样,它有白色背景和黑色文字.有趣的是,我自己的工具栏(动作栏)确实得到了样式.

如何强制使用placepicker活动来采用我的主题?

android android-theme google-places-api google-play-services

8
推荐指数
1
解决办法
1946
查看次数

Android v21中的样式化素材按钮

我试图保持棒棒糖及以上(21+)设备的材料设计波纹效果,并对按钮进行风格化,使其周围没有大的边距/空间.

示例1:具有连锁效应但具有边距/间隙的按钮:

我喜欢这个版本的涟漪效应,但不是布局中的差距

示例2:没有波纹效应且没有边距/间隙的按钮:

我想要这个版本的布局,但有涟漪效应

我希望Exmaple 2的布局具有示例1中使用的涟漪效应.

styles-v21实例1的看法如何:

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

     ... other styles ...

    <style name="FacebookButton" parent="android:Widget.Material.Button">
        <item name="android:colorButtonNormal">#ff3b5998</item>
        <item name="android:layout_margin">0dp</item>
        <item name="android:borderlessButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>


    </style>
    <style name="GoogleButton" parent="android:Widget.Material.Button">
        <item name="android:colorButtonNormal">#ffdd4b39</item>
        <item name="android:layout_margin">0dp</item>
        <item name="android:borderlessButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>


    </style>
    <style name="TwitterButton" parent="android:Widget.Material.Button">
        <item name="android:colorButtonNormal">#ff55acee</item>
        <item name="android:layout_margin">0dp</item>
        <item name="android:borderlessButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>


    </style>
    <style name="SkipButton" parent="android:Widget.Material.Button">
        <item name="android:colorButtonNormal">#ffdfa800</item>
        <item name="android:layout_margin">0dp</item>
        <item name="android:borderlessButtonStyle">@style/Widget.AppCompat.Button.Borderless</item>

    </style>

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

示例1的按钮布局是什么样的:

<Button
    android:id="@+id/login_with_facebook"
    android:text="@string/login_with_facebook"
    android:fontFamily="sans-serif-condensed"
    android:textSize="16sp"
    android:drawableLeft="@drawable/facebook_icon"
    android:drawablePadding="25dp"
    android:layout_width="match_parent"
    android:layout_height="45dp"
    android:layout_weight="16.88"
    android:textColor="#ffffff"
    android:gravity="left|center_vertical"
    android:paddingLeft="45dp" …
Run Code Online (Sandbox Code Playgroud)

android android-theme android-button material-design android-5.0-lollipop

8
推荐指数
1
解决办法
5600
查看次数

无法在样式中设置colorControlNormal和android:textColor

我正在尝试设置材质EditText视图的样式:

<style name="AppTheme.EditText" parent="@style/Widget.AppCompat.EditText">
    <item name="android:textColor">@color/white</item>
    <item name="android:textColorHint">#8AFFFFFF</item>

    <item name="colorControlNormal">@color/white</item>
    <item name="colorControlActivated">@color/white</item>
    <item name="colorControlHighlight">@color/white</item>
</style>
Run Code Online (Sandbox Code Playgroud)

然后我在我的主题上应用样式:

<style name="AppTheme">
    <item name="editTextStyle">@style/AppTheme.EditText</item>
</style>
Run Code Online (Sandbox Code Playgroud)

并将主题应用于活动:

  <activity
        android:name=".MyActivity"
        android:configChanges="keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="stateAlwaysHidden"
        android:theme="@style/AppTheme">
Run Code Online (Sandbox Code Playgroud)

但是,这并没有改变下划线颜色.

我知道我可以更改accentColor以更改下划线颜色,但我不想这样做,因为我需要我的强调颜色与其他一些控件不同.

我可以设置控件下划线颜色吗?

android android-theme android-edittext android-styles material-design

8
推荐指数
1
解决办法
7549
查看次数