2012-04-28 21 views
3

ユーザーがボタンを押したときに表示されるアクションシートを設計しました。別のレイアウトファイルに含める別のxmlファイルです。レイアウトプレビューでは、私が望むのとまったく同じように見えます。しかし、それは私の携帯電話で実行されると、レイアウトは台無しです。レイアウトがプレビューと一致しません

Should Look

そして、ここではそれが見えない方法である:ここで

は、それがどのように見えるべきかである Does Look

誰もがこれが起こっかもしれない理由の任意のアイデアを持っていますか?

アクションシートのレイアウトコードは次のとおりです。右表示されていない部分は、最後の直線的なレイアウトで

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

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/sheet_header" > 

     <ImageButton 
      android:id="@+id/left_justified" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/center_justified" 
      android:layout_toLeftOf="@+id/center_justified" 
      android:background="@android:color/transparent" 
      android:src="@drawable/alignment_left" /> 

     <ImageButton 
      android:id="@+id/center_justified" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="13dp" 
      android:background="@android:color/transparent" 
      android:src="@drawable/alignment_center" /> 

     <ImageButton 
      android:id="@+id/right_justified" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/center_justified" 
      android:layout_toRightOf="@+id/center_justified" 
      android:background="@android:color/transparent" 
      android:src="@drawable/alignment_right" /> 

     <ImageButton 
      android:id="@+id/close_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/center_justified" 
      android:background="@android:color/transparent" 
      android:layout_alignParentRight="true" 
      android:layout_alignTop="@+id/center_justified" 
      android:layout_marginRight="10dp" 
      android:src="@drawable/sheet_done_btn" 
      /> 
    </RelativeLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/sheet_background" 
     android:orientation="vertical" > 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="15dp" > 

      <TextView 
       android:id="@+id/font_text" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1.0" 
       android:gravity="center" 
       android:text="Font" 
       android:textColor="#806014" 
       android:textSize="20sp" /> 

      <TextView 
       android:id="@+id/size_text" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1.0" 
       android:gravity="center" 
       android:text="Size" 
       android:textColor="#806014" 
       android:textSize="20sp" /> 

      <TextView 
       android:id="@+id/color_text" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_weight="1.0" 
       android:gravity="center" 
       android:text="Color" 
       android:textColor="#806014" 
       android:textSize="20sp" /> 
     </LinearLayout> 
    </LinearLayout> 

</LinearLayout> 

されており、ここにそれが含まれている方法です。

<FrameLayout 
    android:layout_alignParentBottom="true" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/edit_text_frame"> 

    <include layout="@layout/edit_text"/> 
</FrameLayout> 

編集:この特定の問題の修正に加えて、誰もが知っているがプレビューが実際に電話に表示される方法と一致しないのはなぜですか?

ありがとうございました!

+0

なぜ、下部にLinearLayoutsをネストしていますか? – Sam

+0

未完成のレイアウトです。その線形レイアウト内にいくつかの要素を追加する必要があります – amc6

答えて

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

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/sheet_header" > 

     <ImageButton 
      android:id="@+id/left_justified" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/center_justified" 
      android:layout_toLeftOf="@+id/center_justified" 
      android:background="@android:color/transparent" 
      android:src="@drawable/alignment_left" /> 

     <ImageButton 
      android:id="@+id/center_justified" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="13dp" 
      android:background="@android:color/transparent" 
      android:src="@drawable/alignment_center" /> 

     <ImageButton 
      android:id="@+id/right_justified" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/center_justified" 
      android:layout_toRightOf="@+id/center_justified" 
      android:background="@android:color/transparent" 
      android:src="@drawable/alignment_right" /> 

     <ImageButton 
      android:id="@+id/close_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBottom="@+id/center_justified" 
      android:background="@android:color/transparent" 
      android:layout_alignParentRight="true" 
      android:layout_alignTop="@+id/center_justified" 
      android:layout_marginRight="10dp" 
      android:src="@drawable/sheet_done_btn" 
      /> 
    </RelativeLayout> 



     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="15dp" 
     android:background="@drawable/sheet_background" 
     android:orientation="vertical" > 

      <TextView 
       android:id="@+id/font_text" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:gravity="center" 
       android:text="Font" 
       android:textColor="#806014" 
       android:textSize="20sp" /> 

      <TextView 
       android:id="@+id/size_text" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:gravity="center" 
       android:text="Size" 
       android:textColor="#806014" 
       android:textSize="20sp" /> 

      <TextView 
       android:id="@+id/color_text" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1" 
       android:gravity="center" 
       android:text="Color" 
       android:textColor="#806014" 
       android:textSize="20sp" /> 
     </LinearLayout> 


</LinearLayout> 
0

フォント、サイズ、カラーTextViewsをテーブルレイアウトに配置することができます。

関連する問題