我正在使用EditTexta PopupWindow.它显示OK,但选择标记不显示在EditText.当我长按时,选项菜单也不会改变EditText.在LogCat中,我看到一个警告
TextView不支持文本选择.动作模式已取消.
因此,EditText无法从剪贴板复制/粘贴文本.有什么方法可以获得"正常"的EditText行为PopupWindow吗?
此代码显示了问题,但我也尝试了很多变化:
EditText edit = new EditText(getContext());
edit.setBackgroundColor(Color.BLUE);
PopupWindow popup = new PopupWindow(edit, 100, 100, true);
popup.setBackgroundDrawable(new BitmapDrawable());
popup.showAtLocation(this, Gravity.NO_GRAVITY, 100, 200);
Run Code Online (Sandbox Code Playgroud) 在自定义的Android视图中,我正在绘制几个可能是双向的用户输入文本.例如希伯来语或阿拉伯语混合英文文本或数字.要绘制文本,我基本上使用视图的Canvas,TextPaint和StaticLayout.实际的代码相当复杂并且分散开来,但绘制文本的位看起来像这样:
TextPaint _paint = getPaint();
Canvas _canvas = ...; // the canvas passed in the View.onDraw(Canvas canvas) method
PointF l = locationCenter(); // the location at which the center of text should be painted
int alignment = getAlignment(); // for this element, can vary for each element.
PointF textSize = getTextBounds(); // the bounding box of the text
String text = userInputText(); // actually some user input BiDi text
switch (alignment) {
case 0:
_paint.setTextAlign(Paint.Align.CENTER);
l.x += textSize.x / 2.0f; …Run Code Online (Sandbox Code Playgroud) 我正试图通过Package Explorer Export> Export Android Application中的内置Proguard支持来使用Proguard.主项目是使用一个库项目,而该库项目又使用了android兼容库,它也使用了这个兼容性库本身.基本上是这样的:
BaseLibraryProject BaseActitivity libs:android-support-v4.jar MainProject使用库BaseLibraryProject libs:android-support-v4.jar
这个应用程序在设备和模拟器上运行正常.然而,Proguard会发出很多警告并存在代码1.
这是Proguard相关列表的最后一点:
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView$OnQueryTextListener
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb: can't find referenced class android.widget.SearchView
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb$1: can't find referenced class android.widget.SearchView$OnQueryTextListener
[2012-04-09 14:19:49 - MainProject] Warning: android.support.v4.widget.SearchViewCompatHoneycomb$1: can't find referenced class android.widget.SearchView
[2012-04-09 …Run Code Online (Sandbox Code Playgroud) 我正在使用 Google Rest API v3 将我的 android 应用程序连接到 Google Drive。当我在没有 Proguard (minifyEnabled=false) 的情况下运行时,一切都很好。但是,当我启用 proguard 时,会调用错误的 REST API 方法。当我在驱动器根别名“root”上调用 Drive.Files.get().execute 时,我得到了 Drive.Files.list().execute 的结果。当我禁用“minifyEnabled”时,我看到了正确的结果。这是控制 Proguard 运行的 build.gradle 部分:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Run Code Online (Sandbox Code Playgroud)
默认的 Proguard 文件是未修改的文件,随 Android Studio 2.2(不是优化版本)分发
这是我的 proguard-rules.pro 文件的内容
-keepattributes EnclosingMethod
-keepattributes InnerClasses
-dontoptimize
-keep class com.google.**
-keep class com.fasterxml.**
-dontwarn com.google.**
Run Code Online (Sandbox Code Playgroud)
当我检查生成的 mapping.txt 时,我仍然看到 imo 应该“保留”的类中的重命名成员。例如:
com.google.api.client.auth.oauth.OAuthParameters -> com.google.api.client.auth.oauth.OAuthParameters:java.security.SecureRandom RANDOM -> l com.google.api.client.auth.oauth。 OAuthSigner …
我无法使用"设备"屏幕截图(如DDMS透视图所示)与我的Archos A80一起使用(它可以与三星Galaxy配合使用).我尝试了Eclipse中Android屏幕捕获问题中提到的建议.当那里运行的DDMS独立时,我看到了Windows控制台:W/ddms:无法获得帧缓冲:超时.我已经在DDMS选项中将时间设置为35000无效.还有其他建议吗?