Tag: scrollview

Android ScrollView不是从顶部开始,而是在GridView的开始

我有一个ScrollView的问题,里面有一个个性化的GridView和其他视图。第一次启动Activity时,ScrollView从顶部开始,但是如果我在其他时间访问Activity,ScrollView会在开始时开始GridView.I使用了在这个链接中find的类ExpandableHeightGridView用于我的GridView。 活动布局的xml代码是这样的: <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scrollViewLuogo" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" > <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fff" > <LinearLayout android:id="@+id/linearLayout2" android:layout_width="wrap_content" android:layout_height="wrap_content" > <ImageView android:id="@+id/imageView1" android:layout_width="150dp" android:layout_height="100dp" android:layout_marginLeft="14dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:adjustViewBounds="true" android:maxHeight="200dp" android:maxWidth="200dp" android:scaleType="fitXY" android:src="@android:drawable/ic_menu_gallery" /> <LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:orientation="vertical" > <TextView android:id="@+id/nomeTVActivityLuogo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold" android:textSize="17sp" android:textColor="#005788" /> <TextView android:id="@+id/indirizzoTVActivityLuogo" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> <LinearLayout […]

是否有可能在ScrollView中有一个ViewPager?

我试图在ScrollView使用一个ViewPager ,但ViewPager没有出现。 如果我删除ScrollView的ViewPager显示正常。 我已经创build了一个简单的testing项目,具体如下: main.xml布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent"> <android.support.v4.view.ViewPager android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/viewpager" /> </ScrollView> </LinearLayout> 活动课: public class ScrollViewWithViewPagerActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ViewPager vp = (ViewPager) findViewById(R.id.viewpager); vp.setAdapter(new MyPagerAdapter(this)); } } class MyPagerAdapter extends PagerAdapter { private Context ctx; […]

如何设置Android ScrollView的衰落边缘的颜色?

我有一个白色背景的Android滚动视图。 渐变的边缘是一个白色的半透明的渐变。 我想改变它是黑色而不是白色。 我有一个ListView在同一个项目中,默认情况下有一个黑色的衰落边缘的白色背景,但我找不到在哪里设置(如果有的话)。

停止ScrollView从EditText设置焦点

Android的ScrollView(当滚动或fling'd)喜欢设置一个EditText的焦点,当它是它的一个孩子。 它发生在你滚动然后释放。 无论如何阻止这种行为? 我尝试了几乎所有我能想到的,以及我在StackOverflow上读到的所有内容。 没有任何工作对我来说。 下面是一个布局示例如果你想testing它。 我绝望地阻止这种愚蠢的行为。 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ScrollView android:id="@+id/scrollView" android:layout_width="fill_parent" android:layout_height="fill_parent" > <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginRight="50dp" android:focusable="true" android:focusableInTouchMode="true" > <EditText android:layout_width="fill_parent" android:layout_height="100dp" android:text="TestApp 1" /> <Button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestApp 1" /> <Button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestApp 1" /> <Button android:id="@+id/btn" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestApp 1" […]

ScrollView只能托pipe一个直接的孩子

我有多个LinearLayout ,组合高度很容易超过设备的屏幕高度。 所以为了使我的布局可滚动,我尝试添加一个ScrollView ,但不幸的是我得到以下错误: Scrollview只能托pipe一个直接的孩子 我做了一些研究,但是即使阅读了一些解决scheme之后,也不能真正理解如何解决这个问题。 我尝试了一些改变,但到目前为止,没有任何工作。 任何帮助? <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:paddingTop="20dip"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Question 1" android:paddingBottom="20dip" android:gravity="center" /> <TextView android:id="@+id/q1_score" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="" android:gravity="center"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:text="Question 2" android:paddingBottom="20dip" android:gravity="center" /> <TextView android:id="@+id/q2_score" android:layout_width="0dp" […]

无法调整ScrollView中的RelativeLayout来填充整个屏幕

我有一个奇怪的问题,我不知道如何解决。 我有一个ScrollView内的RelativeLayout,这个scrollView的高度设置为fill_parent。 那么RelativeLayout也是如此。 尽pipe如此,内容并没有填满整个屏幕,而只是到了这个RelativeLayout中最后一个布局的wrap_content。 这是我的代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.pontai" android:id="@+id/relativeLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/linearLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/relativeLayout3" android:layout_alignParentTop="true" android:layout_alignRight="@+id/relativeLayout5" android:layout_marginTop="5dp" android:orientation="horizontal" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="How much points you have here:" android:textAppearance="?android:attr/textAppearanceSmall" /> <TextView android:id="@+id/textViewTotalPoints1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="120" android:textAppearance="?android:attr/textAppearanceMedium" /> </LinearLayout> <RelativeLayout android:id="@+id/relativeLayout4" […]

没有重力scrollview。 如何使scrollview内的内容为中心

我想要scrollView中的内容。 <ScrollView android:id="@+id/scroller" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="12dp" android:paddingBottom="20dp" android:scrollbarStyle="outsideOverlay" android:layout_gravity="center" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="check" android:gravity="center_vertical|center_horizontal"/> </ScrollView> 注意: scrollvew没有android:gravity属性。 任何溶胶: –

在Android中从ScrollView删除滚动条轨道

我的Android应用程序有一个主要的WebView(从本地资源加载的HTML),我想要使用整个屏幕的宽度,并能够(垂直)滚动。 所以我已经在我的布局XML的ScrollView中包装了WebView,但无论我做什么,我都无法从滚动视图的右侧移除滚动条轨道。 更糟的是,我似乎无法改变滚动条轨道的背景颜色。 该轨道占用约10dp左右,这是在WebView的HTML创build问题。 我想滚动条出现在 Web视图的顶部 (iPhone风格,如果你知道我的意思)。 现在,你可以说“你为什么不改变你的HTML 10px更薄?”,这是我的后备解决scheme,但我宁愿不必。 这里是相关的布局XML片段,你会看到我已经尝试了每个可以find的android:etc属性: <ScrollView android:id="@+id/deal_web_view_holder" android:layout_below="@id/clock_bar_holder" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="false" android:fadingEdge="none" android:background="#02a7e9" android:scrollbars="none" android:scrollbarSize="0dp" android:paddingRight="0dp" android:scrollbarAlwaysDrawVerticalTrack="false" android:scrollbarStyle="insideOverlay" android:scrollbarTrackVertical="@drawable/scrollbar_track_vertical" > <WebView android:id="@+id/deal_web_view" android:layout_width="fill_parent" android:layout_height="wrap_content"/> </ScrollView> 我的目标是平台2.1 / API lvl 7,真的只是处理正常大小的显示器,mdp,hdp和xhdp。

ScrollView中的ViewPager不滚动correclty

我有一个“页面”上有很多组件,谁的内容比设备的高度还要长。 很好,只需把所有的布局(整个页面)放在一个ScrollView ,没问题。 其中一个组件是ViewPager 。 这个呈现正确,但对一个轻扫/一扔的反应是不正确的,这是紧张的,doens不总是工作。 它似乎与ScrollView “混淆”,所以只有当你在一个确切的水平线上ScrollView ,才能100%的工作。 如果我删除ScrollView ,ViewPager完美响应。 我有一个search,并没有发现这是一个已知的缺陷。 有没有人经历过这个? 平台版本:1.6兼容性库v4。 装置:macros达不可思议的S 任何帮助,将不胜感激。 下面是你testing的一些示例代码,注释掉ScrollView ,看它是否工作正常。 活动: package com.ss.activities; import com.ss.R; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.os.Parcelable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.widget.TextView; public class PagerInsideScollViewActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); […]

我可以在Android中以编程方式滚动ScrollView吗?

有什么办法滚动ScrollView编程方式到某个位置? 我创build了一个放置在ScrollViewdynamicTableLayout 。 所以我想要一个特定的行动(如点击一个button等),特定的行应自动滚动到顶部的位置。 可能吗?