小编Moo*_*oom的帖子

删除ActionBar字幕/重置ActionBar文本

我目前正在ActionBar某些页面上设置字幕,但在某些页面上我不想要有副标题.

我可以简单地将副标题的文本设置为空,但这只是删除了文本.它仍然占据了字幕空间,从而推动了标题.这可能很难解释,所以我用图片说明:

例

1)这显示ActionBar没有字幕集,这是我想要设置它的方式.

2这显示了带有字幕集的ActionBar,这是我想在某些页面上显示它的方式.

3)最后,这就是ActionBar我设置字幕并试图删除它的方式.正如你所看到的,标题已被推高,副标题没有消失,它只是没有显示任何内容.

我希望有人可以帮我解决这个问题,我已经尝试了谷歌搜索问题,我已经通过官方的android网站挖掘找到一个getActionBar().ResetSubtitle()或类似的,但到目前为止,我已经空手而归.

android android-actionbar

9
推荐指数
1
解决办法
3799
查看次数

依赖关系 - >无法创建'AppPlugin'类型的插件

我正在努力继续研究我的一个旧项目,它已经有一年的历史了,当时工作正常,但是现在我已经更新了AndroidStudio,它甚至无法构建.

我收到一个错误,说我有两次相同的dex文件:

com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
Run Code Online (Sandbox Code Playgroud)

为了解决这个问题,我可以简单地做'gradle dependencies'来查找罪魁祸首,并排除故障文件,但这是我遇到实际问题的地方.
当我'gradle dependencies'时,我收到以下错误:

FAILURE: Build failed with an exception.      

* Where: 
Build file 'F:\Github\Coinbook\app\build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Could not create plugin of type 'AppPlugin'.

* Try:   
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Run Code Online (Sandbox Code Playgroud)

这是我的完整build.gradle文件:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.moonrain.coinbook"
        minSdkVersion …
Run Code Online (Sandbox Code Playgroud)

android build gradle

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

特定三星设备上的指纹崩溃

我最近发布了一个新应用程序,其中包含对通过指纹进行身份验证的支持

这在我们所有的测试设备上运行良好:
- OnePlus Three
- OnePlus Five
- 三星S6 Edge
- 三星S7
- 三星S8

但是当发布时,我们开始通过这个堆栈跟踪从Fabric崩溃:

Fatal Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.our.app/com.our.app.ui.LoginActivity}: java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=30208, uid=10038 requires android.permission.INTERACT_ACROSS_USERS
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3319)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3415)
       at android.app.ActivityThread.access$1100(ActivityThread.java:229)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1821)
       at android.os.Handler.dispatchMessage(Handler.java:102)
       at android.os.Looper.loop(Looper.java:148)
       at android.app.ActivityThread.main(ActivityThread.java:7325)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=30208, uid=10038 requires android.permission.INTERACT_ACROSS_USERS
       at android.os.Parcel.readException(Parcel.java:1620)
       at android.os.Parcel.readException(Parcel.java:1573)
       at android.hardware.fingerprint.IFingerprintService$Stub$Proxy.hasEnrolledFingerprints(IFingerprintService.java:503)
       at android.hardware.fingerprint.FingerprintManager.hasEnrolledFingerprints(FingerprintManager.java:776)
       at com.our.app.fingerprint.handler.FingerprintHandler.canUseFingerprint(SourceFile:65)
       at com.our.app.Client.canUseFingerprint(SourceFile:335)
       at com.our.app.ui.LoginActivity.updateViewVisibilityBasedOnState(SourceFile:501)
       at com.our.app.ui.LoginActivity.updateViewVisibilityBasedOnState(SourceFile:472) …
Run Code Online (Sandbox Code Playgroud)

android fingerprint

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

使用ButterKnife库,在1个片段中有2个不同的视图

我目前正在尝试使用Android的ButterKnife库来处理一些样板代码(https://github.com/JakeWharton/butterknife)

我已经设置好了,让它半工作,但我遇到了一个我无法解决的问题:/

我有一个片段,其中包含1个单独的ListView元素,对于这个ListView,我附加了一个包含多个元素的页脚视图.

这是我的片段使用库的代码片段:

public class UsersFragment extends Fragment {
    @InjectView(R.id.users_listview_id) AutoUpdatingListView list;

    private View footerView;
    @InjectView(R.id.add_user_footer_firstname_edittext_id) BootstrapEditText firstnameEditText;
    @InjectView(R.id.add_user_footer_middlename_edittext_id) BootstrapEditText middlenameEditText;
    @InjectView(R.id.add_user_footer_lastname_edittext_id) BootstrapEditText lastnameEditText;
    @InjectView(R.id.add_user_footer_cancel_button_id) BootstrapButton cancelButton;
    @InjectView(R.id.add_user_footer_okay_button_id) BootstrapButton okayButton;
    @InjectView(R.id.add_user_footer_facebook_button) BootstrapCircleThumbnail facebookButton;
    @InjectView(R.id.add_user_footer_google_plus_button) BootstrapCircleThumbnail googlePlusButton;
    @InjectView(R.id.add_user_footer_twitter_button) BootstrapCircleThumbnail twitterButton;
    @InjectView(R.id.add_user_footer_linkedin_button) BootstrapCircleThumbnail linkedInButton;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.user_fragment, container, false);
    footerView = ((LayoutInflater) getActivity().getSystemService(Activity.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.add_user_footer_view, null, false);

    ButterKnife.inject(this, rootView);

    list.setAdapter(adapter);
    }
}
Run Code Online (Sandbox Code Playgroud)

上面的代码不起作用,因为我只能注入1个视图,如果我尝试使用它们(2x注入),第二个注入会覆盖第一个,留下我的空值.

我似乎无法指定哪个视图包含我可以使用常规findViewById()的哪些元素.

为了澄清,这是我的非ButterKnife代码(100%工作):

    list = (AutoUpdatingListView) rootView.findViewById(R.id.users_listview_id);
    firstnameEditText …
Run Code Online (Sandbox Code Playgroud)

android android-fragments butterknife

5
推荐指数
1
解决办法
7914
查看次数

NestedScrollView 内的 RecyclerView 导致 RecyclerView 膨胀所有元素

我在将 RecyclerView 放置在 NestedScrollView 中时遇到问题,这会导致呈现 RecyclerView 适配器的所有元素。

这是一个相当大的问题,因为 RecyclerView 显示的列表可能包含数百个元素。

目前这会导致相当多的延迟(显然),因为它必须一次渲染所有视图,并且不能像 RecyclerView 通常那样重用任何已经膨胀的视图。

这是我当前的 XML(删除了一些膨胀以最小化它):

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true"
    android:overScrollMode="never">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="90dp">

            <!-- Some content -->

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <!-- Some more content -->

        </LinearLayout>

        <!-- Product list -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:padding="12dp"/>

            <android.support.v7.widget.RecyclerView
                android:id="@+id/recyclerview"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:overScrollMode="never"/>

        </LinearLayout>

    </LinearLayout>

</android.support.v4.widget.NestedScrollView>
Run Code Online (Sandbox Code Playgroud)

这是我的 onCreateView() 来自 Fragment,它正在膨胀包含 NestedScrollView 和 RecyclerView 的视图:

@Override
public View onCreateView(LayoutInflater inflater, …
Run Code Online (Sandbox Code Playgroud)

xml android scrollview android-recyclerview nestedscrollview

5
推荐指数
1
解决办法
3295
查看次数

Listview的页脚视图未在1台设备上显示,但在另一台设备上显示?

我必须承认,我有一个非常奇怪的问题.

我正在使用Listview构建一个Android应用程序,然后我有一个按钮在这个列表视图中添加页脚视图(您可以在其中键入将项目添加到列表中所需的一些信息)

这很容易完成,100%完全在我自己的手机上工作(三星Galaxy Note 2),但在我的朋友手机(三星Galaxy S2)上,使用相同代码的完全相同的应用程序,当按下"添加页脚"按钮时,没有出现.
我在添加页脚视图时在代码中添加了日志消息,我可以看到打印出的日志消息,因此代码实际上正在执行.但页脚视图永远不会显示出来.

关于应用程序的其他所有工作正常.

有没有人对此有任何想法?我在这里不知所措:/

android listview footer android-listview

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