标签: scrollview

Android滚动视图背景颜色

有没有办法设置scrollview元素的背景颜色?我在下面尝试了以下代码,但颜色未应用:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"  
android:id="@+id/ScrollView01"  
android:layout_width="wrap_content"  
android:layout_height="wrap_content"  
android:scrollbars="vertical" android:background="@color/colorWhite">
<?xml version="1.0" encoding="utf-8"?>

<resources>
    <string name="app_name">Trackfolio</string>
    <color name="colorWhite">#FFFFFF</color>
    <color name="colorBlack">#000000</color>
    <color name="colorLightBlue">#33A1C9</color>
</resources>
Run Code Online (Sandbox Code Playgroud)

android scrollview

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

在Android活动中滚动查看

我做了一个简单的活动,因为我使用了scrollView但它不工作并显示错误,所以我已经删除了scrollView..Friends我需要的是所有菜单都应该包含在scrollView ..请任何人都可以建议我wher7e我应该放置我的活动中的"scrollView"标签.

我的活动如下: 在此输入图像描述

主menu.xml文件

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:orientation="vertical">

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:src="@drawable/kevingreen" android:background="#000" android:layout_weight="1"/>

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="0.3"
        android:background="#fffff3"
        android:orientation="vertical" >



        <LinearLayout
            android:id="@+id/linearLayout4"
            android:layout_width="fill_parent"
            android:layout_height="190dp" >

            <LinearLayout
                android:id="@+id/linearLayout6"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="10dp"
                android:layout_weight="1"
                android:orientation="vertical" >

                <ImageButton
                    android:id="@+id/imageButtonVideos"
                    android:layout_width="fill_parent"
                    android:layout_height="115dp"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="20dp"
                    android:background="#0000"
                    android:scaleType="centerCrop"
                    android:src="@drawable/balcony_pic" />

                <TextView
                    android:id="@+id/textView1"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:gravity="center"
                    android:text="Videos"
                    android:textAppearance="?android:attr/textAppearanceMediumInverse"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/linearLayout7"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginBottom="10dp"
                android:layout_marginTop="10dp"
                android:layout_weight="1"
                android:orientation="vertical" >

                <ImageButton
                    android:id="@+id/ImageButtonTraining2"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="10dp"
                    android:layout_marginRight="10dp"
                    android:layout_marginTop="20dp"
                    android:background="#0000" …
Run Code Online (Sandbox Code Playgroud)

android scrollview android-layout android-scrollview

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

在textview中包含长数据时,scrollview很慢

我正在开发一个RSS源新闻应用程序,我使用scrollview显示标题和说明.我从网页上获取的描述和标题数据太长了,我将这些内容添加到我的textviews(标题和desc),以便当我滚动它是极其缓慢的.请帮助

android scrollview textview

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

如何在Android上获取scrollview总高度= Scrollview.getScrollY()

我已经看过一些论坛,但是这些技巧对我来说不起作用。

我有以下代码:

scrollview = (ScrollView)v.findViewById(R.id.scrollView);
    scrollview.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {

        @Override
        public void onScrollChanged() {

            Log.d(MainActivity.TAG, "scroll ch: "+scrollview.getScrollY()+"/"+scrollview.getChildAt(0).getHeight());
        }
    });
Run Code Online (Sandbox Code Playgroud)

在我的layout.xml中

<ScrollView
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" >

    <LinearLayout
        android:id="@+id/principal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@drawable/horiz"
        android:orientation="vertical"
        android:showDividers="end|middle" >
    </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)

当我向下滚动到最后一个时,我得到的getScrollY()小于getChildAt(0).getHeight()。

我怎样才能使两者的总大小相同?

android scrollview android-scrollview

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

滚动视图内的两列RecyclerView

我想要我的2列RecyclerView,即GridLayoutManager在scrollview中使用.我找到了一种方法,可以从这个链接中将单列recyclelerview放在scrollview中,但我无法弄清楚如何将Grid RecyclerView放在scrollview中.

android scrollview android-recyclerview

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

如何在OSX应用程序的NStextView窗口中启用文本水平滚动?

我在Xcode上花了很长时间没有解决方案,我在Xcode中错过了OSX应用程序的简单功能。当我在NStextView窗口中键入文本或在其中键入文本时,该文本应在右侧继续,并且我可以水平滚动。现在改为改为在下一行显示文本,而我只有垂直滚动。我必须在xcode设置中做什么才能进行水平滚动而不跳到下面的行?

macos xcode scrollview swift

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

如何确定NestedScrollView是否滚动到最后并且是空闲的?

试过:

NestedScrollView ns =(NestedScrollView) findViewById(R.id.nested_scroll);
        ns.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
            @Override
            public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {

            }
        });
Run Code Online (Sandbox Code Playgroud)

但是卡住了,有没有人有想法?

只是为了清除我想要的东西 - 我希望能够观察滚动状态(如在RecyclerView的addOnScrollListener中)并且只在滚动结束(空闲)时检查一次,如果用户滚动到NestedScrollView的末尾.

android scrollview android-scrollview nestedscrollview android-nestedscrollview

0
推荐指数
2
解决办法
6258
查看次数

在NestedScrollview中检查屏幕上是否可见的子视图

在我的活动中,我有一个长滚动视图包含多个视图,当用户向上或向下滚动时,我必须检查文本视图是否在屏幕上可见.

请帮我 .

android scrollview

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

Xcode 8.1:更改约束时没有更新帧的选项

我已经完成了以下步骤:

  1. 将滚动视图添加到主视图.
  2. 添加约束0,0,0,0顶部,左侧,底部,右侧滚动视图.结果:Scrollview更新帧

  3. 添加了滚动视图按钮

  4. 并添加约束0,0,0,0顶部,左侧,底部,右侧甚至宽度,高度

结果:无法更新UIButton的帧

我不知道为什么在将约束应用于按钮视图后无法更新帧.

错误说:具有模糊的可滚动高度 在此输入图像描述

如果我添加其他视图或更改任何像滚动视图的高度约束,它会变成红色,同样的错误.

任何建议.

xcode constraints scrollview ios

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

"match_parent"高度不适用于NestedScrollView中的RelativeLayout

我使用CoordinatorLayout作为我在activity.xml中的根视图.在那个xml中,我使用NestedScrollView并启用了appbar_scrolling_view_behavior.但是NestedScrollView中的内容包装高度而不是匹配父级.

这是我的布局xml

<?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:background="@android:color/white">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_scrollFlags="scroll|enterAlways|snap">
    </android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>

<android.support.v4.widget.NestedScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <ProgressBar
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/content"
            android:padding="20dp"
            android:visibility="gone"/>
    </RelativeLayout>


  </android.support.v4.widget.NestedScrollView>


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

这是布局预览 在此输入图像描述

xml android scrollview android-layout layoutparams

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