小编Cal*_*ark的帖子

对viewpager中的片段改变windowSoftInputMode

我有一个包含2个不同片段的ViewPager.对于第一个片段,我想定义它,以便它不会在软键盘打开时调整大小.对于第二个片段,我想让它调整大小.

设置android:windowSoftInputMode="adjustPan"清单内部将适用于两个片段,但我想在两者之间进行更改.

谷歌搜索后我做了什么:

    // create ContextThemeWrapper from the original Activity Context with the custom theme
    Context context = new ContextThemeWrapper(getActivity(), R.style.NoResize);
    // clone the inflater using the ContextThemeWrapper
    LayoutInflater localInflater = inflater.cloneInContext(context);
    // inflate using the cloned inflater, not the passed in default
    return localInflater.inflate.inflate(R.layout.my_layout,container,false);
Run Code Online (Sandbox Code Playgroud)

我自定义了主题:

<style name="NoResize" parent="@style/AppTheme">
    <item name="android:windowSoftInputMode">adjustPan</item>
</style>
Run Code Online (Sandbox Code Playgroud)

使用默认的windowSoftInputMode定义活动,该软件会在软键盘打开时调整视图大小.

将会解决这个问题,直到它得到解决,但如果其他人有这个问题并解决了它,那么听到任何想法都会很棒.

谢谢!

android

39
推荐指数
1
解决办法
2万
查看次数

Proguard:IllegalArgumentException - 评估指令时出现意外错误

我正在尝试构建一个启用了proguard的发布apk.我收到以下错误.我将在下面附上完整的堆栈跟踪.

Unexpected error while evaluating instruction:
Class       = [*]
  Method      = [myMethod(Ljava/lang/String;Ljava/util/Map;)V]
  Instruction = [532] aload_3 v3
  Exception   = [java.lang.IllegalArgumentException] (Value is not a reference value [proguard.evaluation.value.UnknownIntegerValue])
  Unexpected error while performing partial evaluation:
  Class       = [*]
  Method      = [myMethod(Ljava/lang/String;Ljava/util/Map;)V]
  Exception   = [java.lang.IllegalArgumentException] (Value is not a reference value [proguard.evaluation.value.UnknownIntegerValue])
:*:proguardRelease FAILED
Run Code Online (Sandbox Code Playgroud)

我已将问题缩小到堆栈跟踪中未提及的代码行.

RelativeLayout.LayoutParams relativeLayoutParams = new RelativeLayout.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT);
Run Code Online (Sandbox Code Playgroud)

如果我要对此进行评论,那么proguard会毫无问题地完成.

我目前已将proguard升级到新5.0,但它没有任何效果.

有什么我做错了吗?

异常完全堆栈跟踪:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':*:proguardRelease'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at …
Run Code Online (Sandbox Code Playgroud)

android release proguard illegalargumentexception

6
推荐指数
1
解决办法
3022
查看次数

Espresso测试时选择Native Tabs

我有一个viewpager,它使用原生操作栏Tabs作为指标.我想导航到不同的选项卡,但Tab组件不是视图,因此onView或withText无法正常执行点击.

我是否可以通过Tab导航进行导航?

tabs android-viewpager android-actionbar android-espresso

4
推荐指数
2
解决办法
3515
查看次数

如何抑制资源xml文件中特定行/字符串的lint?

在Android上,我想在string.xml或其他资源文件上抑制特定字符串值或特定行的lint.

<string name="suppress_lint_string">Suppress this String</string>

<string name="dont_suppress_lint_string">Don\'t Suppress this String</string>
Run Code Online (Sandbox Code Playgroud)

我想对特定字符串和布局的特定部分执行特定的lint抑制,例如缺少特定字符串的翻译,这些字符串在语言之间并不重要.

xml android translation lint suppress

3
推荐指数
1
解决办法
2363
查看次数