小编Dra*_*awn的帖子

首选项屏幕自定义布局仅适用于第二次单击

我有一个使用'自定义布局'的首选项屏幕:

android:layout="@layout/currencycodes"
Run Code Online (Sandbox Code Playgroud)

这个问题是它无法在第一次尝试时调出布局.正如您从下面的动画GIF看到的那样,我必须撤退并再次尝试再次进行布局.那为什么呢?

在此输入图像描述

的preferences.xml

<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:key="application_preferences">
    <PreferenceCategory>
        <PreferenceScreen
                android:key="url_settings"
                android:title="@string/url_settings"
                android:summary="@string/summary_url_settings">
        </PreferenceScreen>

        <PreferenceScreen
                android:key="currency_codes"
                android:title="@string/left_handed"
                android:summary="@string/summary_left_handed">
            <Preference
                    android:key="currency_exchanges"
                    android:layout="@layout/currencycodes"/>
        </PreferenceScreen>
        <EditTextPreference
                android:key="url_exchange_rate"
                android:title="@string/url_exchange_rate_settings"
                android:summary="@string/summary_url_exchange_rate"
                android:enabled = "false"/>
    </PreferenceCategory>
</PreferenceScreen>
Run Code Online (Sandbox Code Playgroud)

以下是使用的自定义布局.它包含一个GridView.

currencycodes.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/activity_main"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="true"
        android:focusableInTouchMode="true"
        tools:context=".MainActivity">

    <GridView
            android:layout_width="328dp"
            android:layout_height="479dp"
            android:layout_marginTop="16dp"
            app:layout_constraintTop_toTopOf="parent" android:layout_marginStart="16dp"
            app:layout_constraintLeft_toLeftOf="parent" android:layout_marginEnd="16dp"
            app:layout_constraintRight_toRightOf="parent"
            app:layout_constraintBottom_toBottomOf="parent" android:layout_marginBottom="16dp"
            android:id="@+id/grdExchanges" android:scrollbars="horizontal|vertical"
            android:smoothScrollbar="true" tools:textAlignment="center"
            android:verticalScrollbarPosition="defaultPosition"/>
</android.support.constraint.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)

android preferencescreen

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

为什么Android Studio中的源代码“全红”

我一直在使用Android Studio的调试器来遍历代码,并查看其工作原理。

当我深入研究SDK时,以lisView.java为例,现在它的类成员大多是红色的?(请参阅链接)

这是为什么??在“进入” listView.java之前,我可以看到我的代码和SDK的一部分吗?为什么突然在右列上都变成红色了?

如您在屏幕快照中所见,现在我看不到成员变量的值,例如mOldItemCount。 listView.java的屏幕截图

debugging sdk android android-studio

5
推荐指数
3
解决办法
3083
查看次数

如何在 Android Studio 中将代码推送到第二个单独的 GitHub 存储库?

我很困惑。

我的项目有它的原始 GitHub 存储库。

我必须将 Android 项目推送到第二个存储库。

如何在 Android Studio 中将代码推送到第二个单独的 GitHub 存储库?

我看到有可能的提示,但我不知道如何启动新的存储库。

问候,

git android github repository

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