2014-09-24 80 views
2

我提到的大部分与此相关的主题#1的问题和成功放置我的线性布局滚动型。但我无法滚动它。我的活动是 -无法滚动的LinearLayout这是摆在滚动型

enter image description here

这里的要点是ScrollView-

<ScrollView 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_weight="1" > 

       <LinearLayout 
        android:id="@+id/linearLayoutUP1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="5dp" 
        android:layout_weight="1" 
        android:orientation="vertical" > 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="5dp" 
         android:orientation="vertical" > 

         <TextView 
          android:id="@+id/textViewUP1" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:background="@color/Chocolate" 
          android:gravity="center" 
          android:padding="10dp" 
          android:text=" " 
          android:textAppearance="?android:attr/textAppearanceLarge" 
          android:textColor="@color/Black" 
          android:textStyle="bold" /> 
        </LinearLayout> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="5dp" 
         android:orientation="vertical" > 

         <TextView 
          android:id="@+id/textViewUP2" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:background="@color/Chocolate" 
          android:gravity="center" 
          android:padding="10dp" 
          android:text="User ID : " 
          android:textColor="@color/White" 
          android:textSize="16sp" 
          android:textStyle="bold" /> 
        </LinearLayout> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="5dp" 
         android:orientation="vertical" > 

         <TextView 
          android:id="@+id/textViewUP4" 
          android:layout_width="match_parent" 
          android:layout_height="match_parent" 
          android:background="@color/Chocolate" 
          android:gravity="center" 
          android:padding="10dp" 
          android:text="Gender : " 
          android:textColor="@color/White" 
          android:textSize="16sp" 
          android:textStyle="bold" /> 
        </LinearLayout> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="5dp" 
         android:orientation="vertical" > 

         <TextView 
          android:id="@+id/textViewUP3" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:background="@color/Chocolate" 
          android:gravity="center" 
          android:padding="10dp" 
          android:text="Your Groups" 
          android:textColor="@color/White" 
          android:textSize="16sp" 
          android:textStyle="bold" /> 

         <GridView 
          android:id="@+id/gridViewUP1" 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:numColumns="1" 
          android:padding="5dp" > 
         </GridView> 
        </LinearLayout> 
       </LinearLayout> 
       </ScrollView> 

的XML代码正如你可以看到有在最后的LinearLayout一个GridView。这个GridView在添加ScrollView之前是可滚动的。在添加ScrollView之后,名为'linearLayoutUP1'的布局不能滚动。我怎样才能让它垂直滚动?

+0

您可以发布您的代码。为了看到依赖。 – Supriya 2014-09-24 17:48:51

+0

发表您的xml文件也.. – Lal 2014-09-24 17:49:44

+0

尝试添加'机器人:fillViewport =“真”'你'ScrollView' – Lal 2014-09-24 17:56:52

回答

1

尝试硬编码高度第一LinearLayout..ie变化wrap_content一些1000dp左右。这将使它可以滚动。我完全不确定这是否是解决问题的正确方法..但是告诉你我在面对同样的情况时做了什么。

此外,如果您使用的是android:theme="@android:style/Theme.NoTitleBar.Fullscreen" ..try改变,为android:theme="@android:style/Theme.NoTitleBar" ..ie没有全屏...

再次,检查是否有android:windowSoftInputMode="adjustPan"在manifest..if是删除后,试试你的活动标签那。

这些都是我试图和工作时,我面临着类似的situatuion的解决方案。

Android的活动总是开始滚动到最底层的解决这个问题,请添加android:focusableInTouchMode="true"LinearLayout ..

0

不建议给您的任何类型的滚动型内滚动视图。

您可能要检查了这一点,你的情况,看看它是否工作。

http://lubosplavucha.com/java/2014/05/05/gridview-scrollview-issue/

+0

我应该如何编辑我的代码才能使其工作?我将Activity扩展到我的类,并在您提供的示例中将GridView扩展到该类。 – 2014-09-24 18:02:11