2017-07-14 4 views
0

私は、小規模なプロジェクトに取り組んでいると、突然、レイアウトプレビューのすべてが画面から出てくるmisbehaving.Itsを開始した画面から出てきます。それはレイアウトの高さや幅の場合ではない!あなたはこれらのイメージAndroidのレイアウトは、レイアウトプレビュー

This is the first image

これが第二の画像であるとの鮮明な画像を得ることができます:それは非常に明確である

second image

青色の境界線が画面の外に来ています。

私はSOにこの質問を見つけたが、それは私の質問には関係ありません。

stackoverflow question

これらは私が

を試した事が
  1. 清潔で、プロジェクトが「
  2. 無効化キャッシュを働いていたし、あまりにも避難所のAndroidメーカーを再起動していないプロジェクトを再構築
  3. を働いていないことを確認しますtが働いた:/

これはACTIVのXMLコードであります

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="bk.photoorganizer.DetailsActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="@dimen/appbar_padding_top" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/AppTheme.PopupOverlay"> 
     </android.support.v7.widget.Toolbar> 

    </android.support.design.widget.AppBarLayout> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/photos_rec_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     /> 
    <android.support.design.widget.FloatingActionButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="10dp" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_gravity="bottom|end"/> 
</android.support.design.widget.CoordinatorLayout> 

ity_details.xmlこれはactivity_main.xmlのXMLコードです:事前に

<?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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="bk.photoorganizer.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:id="@+id/appbar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingTop="@dimen/appbar_padding_top" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:layout_scrollFlags="scroll|enterAlways" 
      app:popupTheme="@style/AppTheme.PopupOverlay"> 

     </android.support.v7.widget.Toolbar> 

     <android.support.design.widget.TabLayout 
      android:id="@+id/tabs" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:tabIndicatorColor="#ffffff" 
      app:tabIndicatorHeight="2dp" 
      app:tabSelectedTextColor="#ffffff" 
      app:tabTextAppearance="@style/tabText" 
      app:tabTextColor="#63FFFFFF" 
      /> 

    </android.support.design.widget.AppBarLayout> 

    <android.support.v4.view.ViewPager 
     android:id="@+id/container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"/> 

</android.support.design.widget.CoordinatorLayout> 

おかげで...

+0

xmlコードを投稿するとよいでしょう。 – Ibrahim

+0

は必ず使用RelativeLayoutの代わりCoordinatorLayout @bharath – bharath

+0

..秒お待ちください。 – yash786

答えて

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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     <android.support.design.widget.AppBarLayout 
      android:id="@+id/appbar" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:paddingTop="@dimen/appbar_padding_top" 
      android:theme="@style/AppTheme.AppBarOverlay"> 

      <android.support.v7.widget.Toolbar 
       android:id="@+id/toolbar" 
       android:layout_width="match_parent" 
       android:layout_height="?attr/actionBarSize" 
       android:background="?attr/colorPrimary" 
       app:layout_scrollFlags="scroll|enterAlways" 
       > 
      </android.support.v7.widget.Toolbar> 

     </android.support.design.widget.AppBarLayout> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_below="@+id/appbar"> 
     <include layout="@layout/list_elec" 
      /> 
     </LinearLayout> 
    </RelativeLayout> 


</android.support.design.widget.CoordinatorLayout> 

含まれるレイアウトFrameLayout

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <android.support.v7.widget.RecyclerView 
     android:id="@+id/photos_rec_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     /> 
    <android.support.design.widget.FloatingActionButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="10dp" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     android:layout_gravity="bottom|end"/> 
</FrameLayout> 
+0

私を助けてくれたおかげで兄弟!! – bharath

関連する問題