有没有办法设置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) 我做了一个简单的活动,因为我使用了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) 我正在开发一个RSS源新闻应用程序,我使用scrollview显示标题和说明.我从网页上获取的描述和标题数据太长了,我将这些内容添加到我的textviews(标题和desc),以便当我滚动它是极其缓慢的.请帮助
我已经看过一些论坛,但是这些技巧对我来说不起作用。
我有以下代码:
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()。
我怎样才能使两者的总大小相同?
我想要我的2列RecyclerView,即GridLayoutManager在scrollview中使用.我找到了一种方法,可以从这个链接中将单列recyclelerview放在scrollview中,但我无法弄清楚如何将Grid RecyclerView放在scrollview中.
我在Xcode上花了很长时间没有解决方案,我在Xcode中错过了OSX应用程序的简单功能。当我在NStextView窗口中键入文本或在其中键入文本时,该文本应在右侧继续,并且我可以水平滚动。现在改为改为在下一行显示文本,而我只有垂直滚动。我必须在xcode设置中做什么才能进行水平滚动而不跳到下面的行?
试过:
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,0,0,0顶部,左侧,底部,右侧滚动视图.结果:Scrollview更新帧
添加了滚动视图按钮
结果:无法更新UIButton的帧
我不知道为什么在将约束应用于按钮视图后无法更新帧.
如果我添加其他视图或更改任何像滚动视图的高度约束,它会变成红色,同样的错误.
任何建议.
我使用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)
scrollview ×10
android ×8
xcode ×2
constraints ×1
ios ×1
layoutparams ×1
macos ×1
swift ×1
textview ×1
xml ×1