小编Sam*_*ris的帖子

使用TextInputLayout时更改EditText提示颜色

我正在使用TextInputLayout设计库中的新功能.我可以让它显示并更改浮动标签的颜色.不幸的是,实际EditText提示现在总是白色的.

我试过用XML,样式和编程方式更改hintColor,并尝试使用android.support.v7.widget.AppCompatEditTextEditText提示总是显示白色.

这是我TextInputLayout和我的XMLEditText

<android.support.design.widget.TextInputLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android.support.design:hintTextAppearance="@style/GreenTextInputLayout">


    <EditText

    android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/city"
        android:textColorHint="@color/black"
        android:hint="@string/city" />

</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的样式TextInputLayout(我尝试将hintTextColor属性设为黑色,但没有为我做任何事情):

<style name="GreenTextInputLayout" parent="@style/TextAppearance.AppCompat">
    <item name="android:textColor">@color/homestory_green</item>
</style>
Run Code Online (Sandbox Code Playgroud)

android android-edittext android-textattributes android-support-library android-design-library

134
推荐指数
17
解决办法
19万
查看次数

首先提交Android Studio项目 - 应该遗漏什么?

我正在为一个新的android项目做我的初始提交.我对代码的状态感到满意,但是想知道要添加哪些文件+提交以及我应该遗漏哪些文件.

这是我的.gitignore内容:

# built application files
*.apk
*.ap_

# files for the dex VM
*.dex

# Java class files
*.class

# generated files
bin/
gen/

# Local configuration file (sdk path, etc)
local.properties

# Eclipse project files
.classpath
.project

# Proguard folder generated by Eclipse
proguard/

# Intellij project files
*.iml
*.ipr
*.iws
.idea/
Run Code Online (Sandbox Code Playgroud)

这是我目前的git状态:

.gitignore
.gradle/
app/
build.gradle
build/
gradle/
gradlew
gradlew.bat
import-summary.txt
settings.gradle
Run Code Online (Sandbox Code Playgroud)

git android gitignore android-studio

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

Android RecyclerView 的平滑滚动不适用于初始滚动

我正在开发一款仅在一台运行 KitKat 的设备上运行的 Android 应用程序。

我使用的 RecylerView 的平滑滚动功能在其他物理平板电脑上运行,但 genymotion 不幸的是在它需要运行的一台设备上停止运行。

它不是滚动到某个位置,而是越过目标位置并一直滚动到底部,看起来非常糟糕。

我能够追踪 RecyclerView 类中抽象 SmoothScroller 的错误。

           if (getChildPosition(mTargetView) == mTargetPosition) {
                onTargetFound(mTargetView, recyclerView.mState, mRecyclingAction);
                mRecyclingAction.runIfNecessary(recyclerView);
                stop();
            } else {
                Log.e(TAG, "Passed over target position while smooth scrolling.");
                mTargetView = null;
            }
Run Code Online (Sandbox Code Playgroud)

我使用的是我在网上找到的 SnappingLinearLayoutManager,但将其换成了 Android 中的普通 LinearLayoutManager,但仍然遇到同样的问题。

该列表有 7 个项目长(用户一次可以看到 4 个项目),我滚动到第 5 个项目(位置 4)。

当我滚动到第三个时,我没有收到此错误。

此外,在我上下滚动列表一次后,错误就停止发生。

编辑: 我可以使用layoutManager.scrollToPositionWithOffset(); 但我正在尝试用平滑的滚动动画来做到这一点。

这是我的一些代码和详细信息:

private void setupMainRecyclerViewWithAdapter() {
    mainLayoutManager = new SnappingLinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    mainListRecyclerView.setLayoutManager(mainLayoutManager);

    settingsMainListAdapter = new SettingsListAdapter(SettingsActivity.this,
            settingsPresenter.getSettingsItems(),
            settingsPresenter);

    mainListRecyclerView.setAdapter(settingsMainListAdapter);

    mainListRecyclerView.addItemDecoration(new BottomOffsetDecoration(EXTRA_VERTICAL_SCROLLING_SPACE)); …
Run Code Online (Sandbox Code Playgroud)

android android-scroll android-recyclerview linearlayoutmanager

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