2017-05-14 12 views
0

私は自分のアプリをタブレットに動かすとレイアウトが途切れてしまいます。なぜなら、なぜプレビューで完璧なのは私のコードだと分かりません。 nooby質問を申し訳ありません。私はまったく新しいです。アプリのレイアウトが間違っている

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
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="com.app.thestickermafia.tsm.TSMCatagory" 
    android:background="@drawable/bg"> 

    <ImageButton 
     android:id="@+id/A_F" 
     android:layout_width="240dp" 
     android:layout_height="240dp" 
     app:srcCompat="@drawable/green" 
     tools:layout_editor_absoluteX="50dp" 
     tools:layout_editor_absoluteY="88dp" /> 

    <ImageButton 
     android:id="@+id/G_M" 
     android:layout_width="240dp" 
     android:layout_height="240dp" 
     app:srcCompat="@drawable/green" 
     tools:layout_editor_absoluteX="330dp" 
     tools:layout_editor_absoluteY="88dp" /> 

    <ImageButton 
     android:id="@+id/N_S" 
     android:layout_width="240dp" 
     android:layout_height="240dp" 
     app:srcCompat="@drawable/green" 
     tools:layout_editor_absoluteX="50dp" 
     tools:layout_editor_absoluteY="351dp" /> 

    <ImageButton 
     android:id="@+id/T_Z" 
     android:layout_width="240dp" 
     android:layout_height="240dp" 
     app:srcCompat="@drawable/green" 
     tools:layout_editor_absoluteX="330dp" 
     tools:layout_editor_absoluteY="350dp" /> 

    <ImageButton 
     android:id="@+id/Font" 
     android:layout_width="521dp" 
     android:layout_height="200dp" 
     app:srcCompat="@drawable/orange" 
     tools:layout_editor_absoluteX="50dp" 
     tools:layout_editor_absoluteY="610dp" /> 

    <SearchView 
     android:id="@+id/search_viewr" 
     android:layout_width="520dp" 
     android:layout_height="49dp" 
     android:iconifiedByDefault="false" 
     android:queryHint="Search Ghrapics" 
     tools:layout_editor_absoluteX="50dp" 
     app:layout_constraintTop_toTopOf="parent" 
     android:layout_marginTop="25dp" /> 


</android.support.constraint.ConstraintLayout> 
+0

別のレイアウトを試しましたか?レイアウトの幅を変更しようとしましたか? – Sarah

+0

あなたの投稿にスクリーンショットを追加すると、問題を解決するのに役立ちます。 –

答えて

0

レイアウト内の各Viewに制約を追加する必要があります。 tools:layout_editor_absoluteXおよびtools:layout_editor_absoluteYの値は、デザインビューにのみ適用されます。このreferenceを参照してください。具体的に

あなたがレイアウトエディタにビューを削除すると、それが何の制約を持っていない場合でも、あなたはそれを残してどことどまります。ただし、これは編集を簡単にするためのものです。レイアウトをデバイス上で実行するときにビューに制約がない場合は、[0,0](左上隅)に描画されます。

関連する問題