我正在使用ViewPagerIndicator http://viewpagerindicator.com/
主题指定正在使用的样式(我可以更改样式中的文本颜色并查看它是否影响选项卡文本)
<style name="TabText" parent="Widget.TabPageIndicator.Text">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">14sp</item>
<item name="android:ellipsize">end</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我想控制标签名称的处理时间.我想尝试使用wrap_content(即所以选项卡调整大小以包装文本宽度),我也想尝试使用椭圆化文本(即选项卡的宽度相同,但如果标题太长,则会进行椭圆化处理).

椭圆机适用于旧设备(例如Nexus One)

但在ICS上,椭圆化不起作用,标题只是截断
如何控制VPI中标签文本的宽度和椭圆化?
(在相关的说明中,我发现默认情况下长文本包含在VPI中,所以我用不间断空格搜索替换空格来停止,因为样式中的singleLine = true会导致VPI抛出强制转换异常)
该应用程序包含一个简短显示的启动画面,并且使用IdlingResource通过检测测试对该活动进行测试,以便测试知道启动屏幕何时关闭.问题是SplashActivity在运行API 19的设备上测试期间会抛出与依赖项相关的异常:
import android.support.test.espresso.idling.CountingIdlingResource;
...
private CountingIdlingResource espressoTestIdlingResource =
new CountingIdlingResource("Splash_Delay"); // <-- Exception here line 22
...
Run Code Online (Sandbox Code Playgroud)
应用程序/的build.gradle:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.code.findbugs'
exclude module: 'espresso-idling-resource'
exclude group: "javax.inject"
})
compile 'com.android.support.test.espresso:espresso-idling-resource:2.2.2'
compile 'com.google.dagger:dagger:2.10'
annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
compile 'com.google.dagger:dagger-android:2.10'
compile 'com.google.dagger:dagger-android-support:2.10'
annotationProcessor 'com.google.dagger:dagger-android-processor:2.10'
compile "com.android.support:appcompat-v7:$supportLibraryVersion"
compile "com.android.support:design:$supportLibraryVersion"
compile "com.android.support.constraint:constraint-layout:1.0.2"
compile "com.jakewharton.timber:timber:4.5.1"
compile "com.squareup.phrase:phrase:1.1.0"
compile "com.squareup.retrofit2:retrofit:2.2.0"
compile "com.squareup.retrofit2:converter-gson:2.2.0"
compile "com.squareup.okhttp3:logging-interceptor:3.7.0"
compile 'net.danlew:android.joda:2.9.9'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-crash:10.2.4'
androidTestCompile 'junit:junit:4.12'
} …Run Code Online (Sandbox Code Playgroud) 我使用下面的Proguard配置进行了Ant构建,这是由"android"命令行工具生成的,看起来非常直接.但是当我使用这个脚本构建应用程序时,应用程序会在设备上执行时爆炸,并带有一系列空指针异常(混淆过程会以某种方式向代码添加错误).要修复应用程序,我只需重新构建它,而无需通过Proguard运行它.
您会对使用Proguard和Android应用程序的人提出什么建议,以便a)应用程序在合理程度上进行优化和混淆,但b)没有功能完整性被破坏?
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembernames class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
} …Run Code Online (Sandbox Code Playgroud) 目标是能够将PDF文件添加到应用程序的"assets"文件夹中,并让用户在PDF应用程序(ezPDFReader,Adobe Reader等)中打开该PDF文件.这并不完全是直截了当的,因为PDF首先需要从assets文件夹复制到设备存储.如果设备上没有PDF查看器应用程序,我们需要显示警告消息并将其指向Play商店下载.