我需要类似于此实现的行为但 NestedScrollView 将是父级, RecyclerView 将是 NestedScrollView 的子级。
例如:https : //medium.com/widgetlabs-engineering/scrollable-nestedscrollviews-inside-recyclerview-ca65050d828a
我不确定它是否可以实现。尝试在 child(RV) 滚动时禁用 parent(NSV),但是在 child 上滚动会滚动整个视图,包括 parent。
android android-scrollview android-recyclerview android-nestedscrollview
我搜索了关于这个主题的所有帖子,但我仍然找不到任何解决方案.我有一个大的布局,它可以使用ScrollView滚动,它还有可滚动的EditText.如果我尝试滚动edittext,则布局开始滚动.我怎么解决呢?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="@+id/lroot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/img6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:onClick="runInfo"
android:src="@drawable/info_btn" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/splash" />
<!-- Scrollable EditText -->
<EditText
android:id="@+id/EditText01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:autoLink="all"
android:background="@drawable/isim_soyisim"
android:clickable="true"
android:cursorVisible="true"
android:gravity="left|top"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:longClickable="false"
android:maxLines="5"
android:singleLine="false"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 如何使线性布局水平滚动?我只是在 myscrollview 中包装了一个线性布局,我也在我的 XML 文件中做了什么,但它仍然无法水平滚动超过线性布局大小的内容。这是我的 XML:
<ScrollView
android:id="@+id/scroller"
android:layout_marginTop="16dip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/popup"
android:fadingEdgeLength="5dip"
android:scrollbars="horizontal"
android:overScrollMode="always"
android:isScrollContainer="true"
android:scrollbarAlwaysDrawHorizontalTrack="true"
>
<LinearLayout
android:id="@+id/tracks"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:padding="10dip"/>
</ScrollView >
<ImageView
android:id="@+id/arrow_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/arrow_up" />
<ImageView
android:id="@+id/arrow_down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/scroller"
android:layout_marginTop="-4dip"
android:src="@drawable/arrow_down" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我突然遇到Scrollview超出屏幕底部的问题,这样即使你一直向下滚动它也不会显示它的所有内容.XML是:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFFFFFFF">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="#FFBBBBBB"
android:orientation="vertical" >
<View
android:layout_width="100dp"
android:layout_height="300dp"
android:layout_margin="15dp"
android:layout_gravity="center_horizontal"
android:background="#FFDDDDFF"/>
<View
android:layout_width="100dp"
android:layout_height="300dp"
android:layout_margin="15dp"
android:layout_gravity="center_horizontal"
android:background="#FFDDDDFF"/>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
它没有比这更简单.一旦你完全向下滚动(如滚动条的形状所示),你应该看到底部的白色边缘,但这就是它的样子:

与顶部比较:

底部应该看起来像顶部,只能颠倒.这种情况发生在模拟器,真实设备和我尝试过的几乎所有Android版本中.我不知道我做错了什么(如果有的话......).
请不要猜测,也不要从臀部射击!只测试过答案.我已经浪费了足够的时间在这上面了.谢谢.
我制作了一份时间表申请表
安卓我正在使用ViewPagerIndicator作为片段.但现在我有一个问题,我想把TabPageIndicator放到中心.像这样:

我想设置单个标签的宽度和高度.并将该选项卡设置为支持选定/按下状态的drawable.
我还没有找到解决这些问题的方法.我尝试的东西onPageSelected和ContextThemeWrapper,但不工作.(也许我没有正确使用它).
除了ViewPagerIndicator之外,这一切都有可能成为或者我应该寻找其他东西吗?(也欢迎没有ViewPagerIndicator的其他选项).
图片上的应用程序是Untis Mobile,可以在PlayStore上找到.我已经问过创作者他们是怎么做的,但是他们说应用程序不是开源的.(但我在源代码中发现他们使用TwoDScrollView来做,但我不确定)
编辑:
造型固定vpiTabPageIndicatorStyle.(在XDA开发人员的帮助下!)
当我添加20个项目时,它会保留在中间但仅从项目4到项目17,项目1,2,3,18,19,20不在中间.看到:
我可以添加3个空项目(或空白区域)以确保第一个和最后一个项目位于中间吗?像这样的东西(来自Untis Mobile应用程序):
(我已经尝试过android:paddingLeft,vpiTabPageIndicatorStyle但这不起作用)
我知道这viewPager.setCurrentItem(total/2)会将TabPageIndicator设置在中间,但是它会保持在中间位置,我无法选择其他一天(我称之为onPageScrolled).所以我想滚动选中的一个需要在中间.这可能吗?
java android horizontalscrollview android-scrollview viewpagerindicator
我必须在scrollview中显示一个viewpager(在pager行中的图像下方的图像和文本).我正在从网上下载图像,文本并在寻呼机行中显示.我在srollview中包含了viewpager以支持横向模式.
<com.xxx.myapp.android.ui.CustomScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fadingEdge="none"
android:fillViewport="true"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical" >
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="800dp"
android:layout_gravity="top"
android:layout_marginTop="10dp" />
</LinearLayout>
</com.xxx.myapp.android.ui.CustomScrollView>
Run Code Online (Sandbox Code Playgroud)
这是CustomScrollView.问题是如何根据子高度设置视图寻呼机高度,以便我可以滚动屏幕直到视图寻呼机项目结束.如果我将view pager height设置为wrapcontent,则viewpager中不会显示任何内容.如果我设置了800dp,那么我可以看到寻呼机项目,但屏幕上有不必要的滚动.我不希望我的滚动视图滚动超出寻呼机儿童的高度.请帮我.
我有一个android layout_file,看起来像下面这样
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="@+id/post_ride_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/activity_margin"
android:padding="@dimen/activity_margin"
android:background="@drawable/google_now_style_card"
android:orientation="vertical" >
...
</LinearLayout
</ScrollView
Run Code Online (Sandbox Code Playgroud)
@dimen/activity_margin 是16dp
当我运行应用程序时,我无法滚动到整个布局的底部,因为它不会显示底部边距.这张照片澄清了

请注意,已达到布局底部的提示(从底部发出的光线),但右侧的滚动条表示还有更多内容可向下滚动.
我期望发生的是能够看到底部的边距,就像布局侧面的边距一样.
我有一个ScrollView定义如下:
<ScrollView
...
.../>
<LinearLayout
...
...>
<!-- content -->
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
我用一些ImageView动态填充LinearLayout.现在,有没有办法检查ImageView何时可见或不可见(例如当我向下滚动时)?
我正在尝试以编程方式将从HTML文件中选取的表单字段添加到LinearLayout.我在底部有一个下一个按钮,但它在显示屏上不断切断.我在平板电脑上尝试过,它仍然没有显示出来.
正如您所看到的,元素正在渲染,但最后一个元素由于某种原因而在屏幕上运行.
片段的XML:
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".dataInput.PropertyInfoFragment"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:paddingLeft="20dp"
android:paddingRight="20dp">
<ScrollView
android:fillViewport="true"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/linear_layout_property_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
<Button
android:id="@+id/nextButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/next"
android:background="@color/colorPrimary"
android:textColor="@android:color/white"/>
</LinearLayout>
</ScrollView>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
调用Activity的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:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".dataInput.DataInputActivity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin" …Run Code Online (Sandbox Code Playgroud) android android-linearlayout android-fragments android-scrollview
我需要知道如何在使用Firebase滚动时动态加载数据.如果我使用Firebase查询数据,则必须一次性加载所有数据或始终更改数据.我希望每个限制使用Firebase加载数据,并且在达到此限制后,加载更多数据并且越来越多.
它基本上就像Facebook的时间线 - 作为一个社交网络.
例如:我想从Firebase获得最低限度50的最新记录.达到此限制后,我将下载下50个数据.我想用RecyclerView而不是FirebaseRecycler上课.
FirebaseRecyclerAdapter无法解决我的问题.感谢帮助.我需要点视图布局的facebook时间线等loadind数据,以及点视图数据库的加载数据Firebase(50到50个.下载50个数据,达到限制,加载底部布局的更多数据到50).
你可以帮帮我吗?
android android-scrollview firebase android-recyclerview firebase-realtime-database