2015-09-23 28 views
1

如何滾動功能添加到這個佈局,請幫助不能給出滾動條

<?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" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scrollbarAlwaysDrawVerticalTrack="true"> 
<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 
    <LinearLayout 
     android:id="@+id/viewA" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.6" 
     android:background="@android:color/holo_purple" 
     android:orientation="horizontal"> 
     <ImageView 
      android:layout_height="100dp" 
      android:layout_width="match_parent" 
      android:scaleType="fitXY" 
      android:id="@+id/expanded_thumbnail"/> 
     </LinearLayout> 
    <RelativeLayout 
     android:id="@+id/viewB" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.4" 
     android:background="@android:color/white" 
     android:orientation="horizontal"> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Sangam 2015" 
      android:textStyle="bold" 
      android:textSize="15sp" 
      android:id="@+id/expanded_title" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      android:layout_alignParentStart="true" 
      android:layout_marginLeft="33dp" 
      android:layout_marginStart="33dp" 
      android:layout_marginTop="31dp" /> 
     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="8-10th September 2015" 
      android:textSize="10dp" 
      android:textStyle="bold" 
      android:layout_marginTop="5dp" 
      android:id="@+id/expanded_date" 
      android:layout_below="@+id/expanded_title" 
      android:layout_alignLeft="@+id/expanded_title" 
      android:layout_alignStart="@+id/expanded_title" /> 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:text="My name is dushyant suthar" 
      android:id="@+id/expanded_description" 
      android:gravity="left" 
      android:layout_marginTop="12dp" 
      android:layout_below="@+id/expanded_date" 
      android:layout_alignLeft="@+id/expanded_date" 
      android:layout_alignStart="@+id/expanded_date" /> 

    </RelativeLayout> 
     </LinearLayout> 
</ScrollView> 
<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="16dp" 
    android:clickable="true" 
    app:layout_anchor="@id/viewA" 
    app:layout_anchorGravity="bottom|right|end"/> 

當我使用上面的代碼中的ImageView越來越小(圖像的高度是越來越下降)並注意像在整個佈局中滾動。

我不知道滾動的看法我沒有通過谷歌搜索我想要一個很好的鏈接,也高於XML的解決方案,我應該添加在Java代碼中有什麼瞭解

回答

0

你的代碼似乎確定我,但通過移除Android的嘗試.support.design.widget.CoordinatorLayout import or android:scrollbarAlwaysDrawVerticalTrack =「true」