2017-03-01 55 views
0

內工作的下面是我的代碼,我不能夠滾動佈局看着奇怪,當我把scrollview滾動型是沒有的FrameLayout

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#0099cc" 
    tools:context="willapp.stpl.com.willapp.util.ActivityPrintView"> 
    <ScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:fillViewport="true" 

     android:orientation="horizontal"> 



    <!-- The primary full-screen view. This can be replaced with whatever view 
     is needed to present your content, e.g. VideoView, SurfaceView, 
     TextureView, etc. --> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:id="@+id/rootLayout"> 


     <LinearLayout 
      android:id="@+id/table1heading" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Select executer's relationship" 
       android:id="@+id/txtHeading"/> 

     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:padding="5dp" 
      android:id="@+id/mainactivity_layoutName" 
      android:layout_below="@+id/table1heading" 
      android:layout_centerVertical="true" > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/mainactivity_txtLabelName" 
       android:text="Full Name:"/> 

      <View 
       android:layout_width="0dp" 
       android:layout_height="0dp" 
       android:layout_weight="1"> 

      </View> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/mainactivity_txtValueName" 
       android:text="Sssdadaad"/> 

     </LinearLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:id="@+id/mainactivity_layoutLine1" 
      android:padding="5dp" 
      android:layout_below="@+id/mainactivity_layoutName" 
      android:layout_centerVertical="true" > 

      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/mainactivity_txtLabelLine1" 
       android:text="Address Line1:"/> 

      <View 
       android:layout_width="0dp" 
       android:layout_height="0dp" 
       android:layout_weight="1"> 

      </View> 
      <TextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:id="@+id/mainactivity_txtValueLine1" 
       android:text="Sssdadaad"/> 

     </LinearLayout> 





     </RelativeLayout> 
</ScrollView> 



</FrameLayout> 
+0

將是有益的,如果問題是多一點的描述。 – eRaisedToX

+0

將RelativeLayout寬度更改爲wrap_content並嘗試 –

回答

1

ScrollView嘗試使用LinearLayout而不是RelativeLayout

事情是這樣的:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#0099cc" 
    tools:context="willapp.stpl.com.willapp.util.ActivityPrintView"> 
    <ScrollView 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:fillViewport="true" 

     android:orientation="horizontal"> 


     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

     // and here your main Relative layout 

     </LinearLayout> 

    </ScrollView> 
</FrameLayout> 
+0

爲什麼不能使用relativelayout? –

+0

爲我工作,但不知道它爲什麼工作。? –