Questions tagged «android»

Android是Google的移动操作系统,用于对数字设备(智能手机,平板电脑,汽车,电视,Wear,Glass和IoT)进行编程或开发。对于与Android相关的主题,请使用特定于Android的标签,例如android-intent,android-activity,android-adapter等。对于与开发或编程无关但与Android框架相关的问题,请使用以下链接:https:// android.stackexchange.com。

6
如果仅添加新表,则迁移会议室数据库
假设我有一个简单的Room数据库: @Database(entities = {User.class}, version = 1) abstract class AppDatabase extends RoomDatabase { public abstract Dao getDao(); } 现在,我要添加一个新实体:Pet并将版本增加到2: @Database(entities = {User.class, Pet.class}, version = 2) abstract class AppDatabase extends RoomDatabase { public abstract Dao getDao(); } 当然,Room会引发异常: java.lang.IllegalStateException: A migration from 1 to 2 is necessary. 假设我没有更改User类(因此所有数据都是安全的),我必须提供仅创建一个新表的迁移。因此,我正在研究Room生成的类,搜索生成的查询以创建我的新表,将其复制并粘贴到迁移中: final Migration …

30
如何处理Android中丢失的KeyStore密码?
我忘记了我的密钥库密码,而且我真的不知道该怎么办(我不能或不会为此找任何借口)。我想更新我的应用程序,因为我刚刚修复了一个错误,但现在不可能了。如果我使用相同的密钥库但创建一个新密钥会怎样?我仍然可以更新该应用程序,如果无法更新,该如何向用户提供有关更新版本的信息? 如果有人遇到这样的问题或遇到麻烦,您能提供什么建议来帮助纠正这种情况?幸运的是,它是一个免费的应用程序。
98 android  keystore 

5
Android:选择器中禁用按钮的textColor没有显示?
我试图用选择器制作一个按钮,我的按钮可以具有以下状态: 启用/禁用 按下/未按下 根据上述状态。我需要操纵按钮的: 文字颜色 背景图像 该按钮从被禁用开始,因此应该具有禁用的textColor和禁用的按钮背景。但是我可以看到默认的textColor(以样式指定)并且没有背景图片! 这是我的选择器button_selector.xml <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="false" android:state_enabled="false" android:textColor="#9D9FA2" android:drawable="@drawable/button" /> <item android:state_pressed="true" android:state_enabled="true" android:drawable="@drawable/button_pressed"/> <item android:state_pressed="true" android:state_enabled="false" android:textColor="#9D9FA2" android:drawable="@drawable/button"/> <item android:state_pressed="false" android:state_enabled="true" android:drawable="@drawable/button"/> </selector> 这是我的layout.xml中的按钮声明 <Button android:id="@+id/reserve_button" android:text="@string/reserve_button" android:layout_width="120dp" android:layout_height="40dp" android:layout_marginTop="10dp" android:layout_marginLeft="20dp" android:paddingRight="15dp" android:layout_gravity="left" style="@style/buttonStyle" android:background="@drawable/button_selector" /> 最后这就是我的风格(设置了我的默认textColor) <?xml version="1.0" encoding="utf-8"?> …


7
使用Glide加载图像时的进度条
是否可以在带有旋转动画的占位符中加载微调框,直到使用Glide加载图像为止? 我正在尝试使用.placeholder(R.Drawable.spinner)做到没有动画出现? 如果有人可以帮助我,那就太好了吗? 谢谢!

12
带有translatable =“ false”的strings.xml中的“在此处翻译但未在默认语言环境中找到”错误
这是我的values \ strings.xml(默认文件),所有内容都可以自我解释: 我的问题: 如果我正在编辑默认语言环境(values \ strings.xml),如何在“默认语言环境中找不到”? 如果设置,translatable="false"怎么会出现皮棉翻译错误?在values-pl \ strings.xml(以及values-ru,values-iw文件夹中)中,字符串甚至不存在?无论如何都不应该。 我似乎无法理解为什么我没有收到俄文字符串的错误。 (我将在此处显示values-ru \ string.xml或values-pl \ string.xml,但是没有什么值得关注的,因为无论如何都缺少字符串...)

3
无法显示HTML字符串
我正在Android WebView中使用显示字符串HTML挣扎。 在服务器端,我下载了一个网页并转义了HTML字符和引号(我使用了Python): my_string = html.escape(my_string, True) 在Android客户端上:字符串不通过以下方式转义: myString = StringEscapeUtils.unescapeHtml4(myString) webview.loadData( myString, "text/html", "encoding"); 但是,webview只是将它们显示为文字字符串。结果如下: 编辑:我添加从服务器端返回的原始字符串: 链接rel =“ apple-touch-icon”;尺寸=“ 114x114” href =“" /static/favicon/apple-touch-icon-114x114.png”> < link rel =“苹果触摸图标”;尺寸=“ 72x72” href =“" /static/favicon/apple-touch-icon-72x72.png”> < link rel =“苹果触摸图标”;尺寸=“ 144x144” href =“" /static/favicon/apple-touch-icon-144x144.png”> < link rel =“苹果触摸图标”;尺寸=“ 60x60” href =“" /static/favicon/apple-touch-icon-60x60.png”> < link …
98 android  python  html  webview 

10
找不到ID为“ com.google.gms.google-services”的插件
我已点击此链接将广告集成到我的应用中。但它显示此错误: 这是我的build.gradle: apply plugin: 'com.android.application' apply plugin: 'com.google.gms.google-services' android { compileSdkVersion 24 buildToolsVersion "24.0.2" defaultConfig { applicationId "com.example.personal.numbermania" minSdkVersion 10 targetSdkVersion 24 versionCode 1 versionName "1.0" } buildTypes { debug { debuggable true } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') …



6
动画自定义对话框
我正在尝试显示自定义对话框,就像它从文本视图中滑落一样。这可能吗?我似乎无法将任何动画应用于对话框类。我已经在构造函数中尝试过这一行,但是没有效果: this.getWindow()。setWindowAnimations(R.anim.paranimation); 我什至不确定动画是否正确,但是一旦看到动画效果,便可以对其进行调整。为了完整起见,我将在下面列出。我不是在寻求有关实际动画的帮助,而只是在对话框的应用程序上寻求帮助。 paranimation.xml: <?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android" android:fromXDelta="-200%" android:toXDelta="0%" android:fromYDelta="200%" android:toYDelta="0%" android:duration="3000" android:zAdjustment="top"> </translate>



5
如何从Android appcompat v7 21库实现DrawerArrowToggle
因此,既然发布了Android 5.0,我想知道如何实现动画的操作栏图标。 该库在这里实现它为我好,但由于程序兼容性V7图书馆它怎么能实现? 该库在themes.xml中引用了它 <item name="drawerArrowStyle">@style/Widget.AppCompat.DrawerArrowToggle</item> 在这种风格下 <style name="Base.V7.Theme.AppCompat" parent="Platform.AppCompat"> 更新 我使用v7 DrawerToggle实现了此功能。但是我不能定型。请帮忙 我在v7 styles_base.xml中找到了样式 <style name="Base.Widget.AppCompat.DrawerArrowToggle" parent=""> <item name="color">?android:attr/textColorSecondary</item> <item name="thickness">2dp</item> <item name="barSize">18dp</item> <item name="gapBetweenBars">3dp</item> <item name="topBottomBarArrowSize">11.31dp</item> <item name="middleBarArrowSize">16dp</item> <item name="drawableSize">24dp</item> <item name="spinBars">true</item> </style> 我将此添加到了样式中,但没有用。还添加到我的attr.xml <declare-styleable name="DrawerArrowToggle"> <!-- The drawing color for the bars --> <attr name="color" format="color"/> <!-- …

12
Android ListView分隔线
我有这个代码: <ListView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/cashItemsList" android:cacheColorHint="#00000000" android:divider="@drawable/list_divider"></ListView> 在哪里@drawable/list_divider: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:width="1dp" android:color="#8F8F8F" android:dashWidth="1dp" android:dashGap="1dp" /> </shape> 但我看不到任何分隔线。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.