标签: scrollview

升级到iOS7/xcode 5后,UIScrollView不会滚动

我有一个应用程序,在xcode 4.5和ios 6.1滚动时工作得很好.但是,在下载xcode 5和iOS 7后,我的滚动视图不再起作用了.???

这是我的.h文件:

#import <UIKit/UIKit.h>

@interface GrillretterViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIScrollView *grillretterScroller;
@property (assign) CGPoint rememberContentOffset;

@end
Run Code Online (Sandbox Code Playgroud)

这是我的.m文件:

#import "GrillretterViewController.h"

@interface GrillretterViewController ()

@end

@implementation GrillretterViewController
@synthesize grillretterScroller, rememberContentOffset;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    [grillretterScroller setScrollEnabled:YES];

    // Do any additional setup after loading the view.
}

- (void) viewDidAppear:(BOOL)animated {
    [grillretterScroller setContentSize:CGSizeMake(300, 915)]; …
Run Code Online (Sandbox Code Playgroud)

objective-c scrollview uiscrollview ios7 xcode5

19
推荐指数
4
解决办法
3万
查看次数

Android scrollview没有填充父视图

我有以下包含scrollview的布局.在屏幕尺寸大于4.8"之后,视图底部会出现一个白色区域.为什么这样,当我指定了scroll_farent的scrollview?

提前致谢.

注意,你看不到下面屏幕截图菜单下方的空白区域,因为它是白色的,对不起.有一英寸或2英寸的空间

 <?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"
        >



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




        <TextView
            android:id="@+id/textviewcompanyname"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87" />

        <TextView
            android:id="@+id/textViewYouAreSignedIn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_alignParentTop="true"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87"
             />

              <TextView
            android:id="@+id/textViewUnsentTransactions"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_below="@id/textViewYouAreSignedIn"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87"
             />

        <TextView
            android:id="@+id/spacerasnexttextviewclasheswithbg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:textAppearance="?android:attr/textAppearanceLarge"
             />

        <LinearLayout

            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <ImageView 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/imagesignaltower"
                android:background="@drawable/signaltower"/>

            <ProgressBar
            android:id="@+id/progressBarSignal"
            style="?android:attr/progressBarStyleHorizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:progressDrawable="@drawable/progressbar2"
            android:layout_marginTop="10dp" />

        </LinearLayout>


        <TextView
            android:id="@+id/textview1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="@string/stringloggedinscreen"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#003F87" />

    <Button …
Run Code Online (Sandbox Code Playgroud)

android view scrollview android-layout

19
推荐指数
3
解决办法
1万
查看次数

Google+个人资料,例如滚动效果

我正在研究Google plus Android应用程序并想知道他们是如何在个人资料视图中实现滚动效果的,我在网上搜索了2天并没有找到任何关于此的教程,任何人都不知道我在说什么可以查看我在Nexus 7上拍摄的屏幕截图.

现在我的好奇心是知道如何达到这个效果,任何有想法的人都会引导我.查看GIF

android scroll scrollview google-plus

18
推荐指数
4
解决办法
1万
查看次数

ScrollView - 如何在Eclipse中设计布局时向下滚动?

我一直在我的应用程序中使用滚动视图,但问题是这是我第一次绘制比默认大小屏幕更长的内容.

XML Design屏幕显示固定的3.7英寸(或更大)屏幕.如果我想添加更多对象怎么办?在Eclipse中进行设计时如何向下滚动?

xml android scrollview

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

键盘启动时,Android ScrollView不会滚动

我的视图没有填满屏幕,但是当键盘出现时,您无法向下滚动到现在覆盖的几个字段.我尝试在清单和类中添加adjustSize,adjustPan.xml类似于以下条目:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/s"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    >

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here -->
    </TableRow>
        <TableRow
        android:id="@+id/tableRow5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <!-- TextViews & EditTexts are here …
Run Code Online (Sandbox Code Playgroud)

keyboard android scrollview

17
推荐指数
1
解决办法
3万
查看次数

检查android scrollview是否可以滚动

你知道是否有可能知道Android Widget ScrollView是否可以滚动?如果它有足够的空间,则不需要滚动,但只要维度超过最大值,窗口小部件就可以滚动.

我在参考文献中没有看到可以提供此信息的方法.也许有可能在scrollview中使用linearlayout的大小做一些事情?

android scrollview

17
推荐指数
3
解决办法
1万
查看次数

SwiftUI - 滚动视图内的垂直居中内容

我正在尝试在我的应用程序上编写一个简单的登录页面。我开始在我新更新的 Mac OS Catalina 上使用 SwiftUI。Apple 文档仍然缺乏很多。我需要在占据整个页面的 Scrollview 上垂直居中一个 VStack,其宽度为 400 的“限制”。

像这样的东西:

ScrollView(.vertical) {
    VStack {
        Text("Hello World")
    }
    .frame(maxWidth: 400, alignment: .center)
}
Run Code Online (Sandbox Code Playgroud)

使用 UIScrollView 很容易,只需要设置 ContentView 以填充高度和宽度,然后在内容视图中居中垂直 StackLayout 但现在使用 SwiftUI 我只是想知道..

目标是这样的(感谢作者)

在此处输入图片说明

如果有人想知道为什么我想要滚动视图中的所有内容,那是因为我的表单非常大,我希望用户同时使用横向和纵向视图,所以我真的需要内容可以滚动,还要记住,在 Ipad 中表单不会填满整个屏幕,这就是我希望它垂直居中的原因。

authentication scrollview ios swiftui

17
推荐指数
2
解决办法
3892
查看次数

swiftUI中scrollView的填充高度

我正在使用 swiftUI 进行编码,并且我有一个垂直的scrollView(参见屏幕截图),在其中scrollView我有另一个水平的scrollView,在其下面我有一个VStack我希望高度将屏幕的其余部分填充到垂直的底部scrollView,但我似乎无法让它发挥作用。

在某些情况下,垂直方向的内容scrollView可能大于实际剩余空间,这就是为什么我需要滚动视图,但在其他一些情况下,内容小于剩余空间

这是我的代码:

    VStack {
        HeaderView
        
        ScrollView(.vertical, showsIndicators: false) {
            FriendsHorizontalScrollView()
            
            VStack {
                // I want this view to take all the remaining height left in the scrollView
                FullHeightView()
            }
            .frame(width: UIScreen.main.bounds.width)
        }
    }
Run Code Online (Sandbox Code Playgroud)

我最终得到的是这样的:

在此输入图像描述

我想要拥有什么:

在此输入图像描述

我尝试了几种解决方案,例如使用 GeometryReader 或安装.frame(maxHeight: .infinity),VStack但似乎都无法正常工作。

scrollview ios swift swift5 swiftui

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

Android ScrollView在子imageview的顶部和底部添加了额外的填充

我在渲染ScrollView时遇到问题.基本上,布局是固定的页眉和页脚,中间有一个滚动视图.我们的想法是,当为内容EditText激活屏幕键盘时,如果图像的高度比中间视图长,则可以滚动图像.

在测试布局时,我发现在我的Android手机(Xperia X10 Android 1.6)上,在ImageView的顶部和底部添加了一大堆填充.

我很感激有关如何防止这种情况发生的任何建议.

<?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">

    <!-- Header -->
    <RelativeLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#FFFFFF">
        <TextView
            android:text="Share your photo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="left"/>
        <Button
            android:id="@+id/btnStack"
            android:text="Stacks"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"/>
    </RelativeLayout>
    <!-- End Header -->


    <!-- Body -->
    <ScrollView
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:padding="5px"
        android:background="#CCCCCC">
        <ImageView
            android:id="@+id/imgPreview"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"/>
    </ScrollView>
    <!-- End Body -->


    <!-- Footer -->
    <RelativeLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:layout_alignParentBottom="true">
        <EditText
            android:id="@+id/caption"
            android:text="Type your caption"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"/>

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/caption" …
Run Code Online (Sandbox Code Playgroud)

android emulation scrollview imageview

16
推荐指数
3
解决办法
2万
查看次数

在ScrollView android内部切断了CardView底部边框

我将cardview放在scrollview中,我们希望看到底部应该显示边框(见下图).但事实并非如此.问题是我无法滚动到底部以查看cardview的边框.

SO上的所有解决方案都是将layout_margins更改为paddings,但如果我们想要显示边框,则不是cardview的情况.我基本上尝试了一切.但仍然无法奏效. 滚动到底部无法看到边框

图片1.滚动到底部无法看到边框

我们可以看到顶部边界

图2.我们可以看到顶部边框

以下是xml代码

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true">

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_margin="8dp">
                    <LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical"
                      >
                     ...
                    </LinearLayout>
           </CardView>
  </LinearLayout>
Run Code Online (Sandbox Code Playgroud)

参考: ScrollView不会滚动到底部

ScrollView会切掉顶部并在底部留出空间

我无法在底部显示LinearLayout以滚动视图

Android ScrollView拒绝滚动到底部

android scrollview cardview

16
推荐指数
3
解决办法
7680
查看次数