【问题标题】:ScrollView not scrolling all the way downScrollView 没有一直向下滚动
【发布时间】:2015-09-18 16:06:53
【问题描述】:

我在我的应用程序中使用滚动视图,如下所示。但是屏幕的底部并不完全可见,即使我已经尽可能地向下滚动。我做错了什么还是有办法解决这个问题?

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

    <Button    
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"
        android:text="Name"
      />  

   <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:fillViewport="true">

      <LinearLayout    
        android:orientation="vertical"  
        android:layout_width="fill_parent"  
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal" >  

                <TableLayout
                android:layout_height="wrap_content"
                android:layout_width="fill_parent"
                android:layout_centerHorizontal="true">

                    <TableRow> 
                    <TextView 
                        android:layout_height="wrap_content" 
                        android:layout_width="wrap_content"
                        android:text="name">
                    </TextView>
                    <EditText 
                        android:layout_width="wrap_content" 
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        >
                    </EditText>
                    </TableRow> </TableLayout>   </LinearLayout> </ScrollView>

【问题讨论】:

  • 滚动视图直到屏幕底部的最后一项才会向下移动。
  • 我不知道为什么有些人对否定投票和评论而不是回答感兴趣。

标签: android scrollview


【解决方案1】:

试试这个

 scrollview.scrollTo(0, scrollview.getBottom());

【讨论】:

    【解决方案2】:

    曾经遇到同样的问题
    您可以通过
    scrollview.scrollTo(0, scrollview.getBottom());
    将滚动位置设置在底部,如果它不起作用,我认为问题出在您的AVD,因此请通过Android SDK and AVD Manager 更改AVD 的屏幕大小。选择您的 AVD 并通过检查 Scaledisplay to real size 到适当的大小来启动它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-04
      • 2011-08-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多