小编Vin*_* D.的帖子

Android Studio,修改"foreach"命令行返回的样式

我无法想象Android Studio如何foreach通过将它放在两行上来处理实时模板的样式:

 for ( :
   ) {

   }
Run Code Online (Sandbox Code Playgroud)
  • Editor -> Live templates -> Android -> foreach我们可以根据样式取消选择Reformat并且它保持在一行但它看起来像一个临时修复.

我想找到where(according to style),以便能够修改它.谢谢

foreach android code-formatting intellij-idea android-studio

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

NestedScrollView canScrollVertically返回特定大小内容的false

上下文
在我的顶部标题中,我有一个按钮,让第二个TextView为View.VisibleView.Gone.我的ViewPager内容具有特定的大小来演示我的问题,可在Nexus 5上重现.

问题
当我打开我的应用程序并向上和向下滚动内容时,我没有任何问题.然后我隐藏了我的第二个textview.
现在,如果我的手指从TextView(蓝色)或按钮(橙色)开始滚动,我就不能滚动了.但是,如果我的手指开始从白色背景滚动它是有效的.

在此输入图像描述

在隐藏第二个文本上单击两次后(返回初始布局),当我滚动时,布局开始从底部开始近似地显示在40dp(appBarSize)

在此输入图像描述

测试
- 替换EditTextButton通过ViewTextView滚动
- 在内容添加高度和滚动的底部添加虚拟视图
- 向内容添加更多大小与上一点相同 - 在NestedScrollView(第583行)中onInterceptTouchEvent ViewCompat.canScrollVertically(this,1)返回false在这个特别高的内容大小

/*
 * Don't try to intercept touch if we can't scroll anyway.
 */
if (getScrollY() == 0 && !ViewCompat.canScrollVertically(this, 1)) {
    return false;
}
Run Code Online (Sandbox Code Playgroud)

不是那么类似的问题:
由于EditText而导致NestedScrollView无法滚动
CollapsingToolBar无法处理不那么高的内容

任何帮助欢迎:)

完整代码项目(在dropbox上)

LayoutFile

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    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:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/activity_main_header_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#aaeeee"
        android:descendantFocusability="beforeDescendants"
        android:focusableInTouchMode="true">


        <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-design-library

6
推荐指数
0
解决办法
1288
查看次数