2017-06-30 26 views
-1

私はアンドロイドスタジオでこのテンプレートのcontentmain.xmlファイルで簡単なナビゲーションテーマを使用しています。カスタムレイアウトデザインを追加する必要があります。スクロールしない、ランドスケープモードが変更されたら、デザインをスクロールできません。Androidスクロール表示が機能していませんか?

以下はcontent-main.xmlのコードです。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:context="com.techinfoworld.gymfitnessworkoutinstructions.MainActivity" 
android:orientation="vertical" 
tools:showIn="@layout/app_bar_main"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/side_nav_bar"> 
     <ImageView 
      android:background="@drawable/gym1" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_marginTop="2dp" 
      android:id="@+id/imageView3" 
      android:layout_centerHorizontal="true" 
      android:layout_alignParentTop="true" /> 
    </LinearLayout> 

<LinearLayout 
    android:gravity="center" 
    android:layout_marginTop="176dp" 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:background="@android:drawable/spinner_background" 
    android:layout_marginLeft="5dp"> 

    <LinearLayout 
     android:gravity="center" 
     android:orientation="vertical" 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" > 
     <Button 
      android:background="@drawable/abs_workout" 
      android:layout_width="100dp" 
      android:layout_height="100dp" 
      /> 
     <Button 
      android:layout_marginTop="20dp" 
      android:background="@drawable/butt_workout" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 
     <Button 
      android:layout_marginTop="20dp" 
      android:background="@drawable/favourites" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 

    </LinearLayout> 

    <LinearLayout 
     android:gravity="center" 
     android:orientation="vertical" 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content"> 
     <Button 
      android:background="@drawable/arm_workout" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 
     <Button 
      android:layout_marginTop="20dp" 
      android:background="@drawable/full_workout" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 
     <Button 
      android:layout_marginTop="20dp" 
      android:background="@drawable/share" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 
    </LinearLayout> 
    <LinearLayout 
     android:gravity="center" 
     android:orientation="vertical" 
     android:layout_weight="1" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     > 

     <Button 
      android:background="@drawable/leg_workout" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 

     <Button 
      android:layout_marginTop="20dp" 
      android:background="@drawable/workout_tips" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 
     <Button 
      android:layout_marginTop="20dp" 
      android:background="@drawable/rate" 
      android:layout_width="100dp" 
      android:layout_height="100dp" /> 
    </LinearLayout> 
</LinearLayout> 


<Button 
    android:textColor="#fff" 
    android:text="Workout Daily to Get Fit GYM Body !!! " 
    android:layout_alignParentBottom="true" 
    android:background="@color/colorAccent" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" /> 


</RelativeLayout> 

答えて

2

あなたはスクロール動作を得るためにScrollViewタグでレイアウトをラップする必要があります。

look here for more

+1

と 'ScrollView'がちょうど1つのビューを受け入れ、そのリニア/相対レイアウトの内部のすべてのコンポーネントをラップ:) – kamiha

+0

自分が初心者、あなたは、コードを再修正し、私に戻って送信することができますそれはあなたのために可能ですか?私は同じレイアウトデザインが必要です、あなたは私を助けることができますか? @appyx –

関連する問題