2012-05-04 11 views
1

私は最初のボタンを表示し、画像のみを使う必要があります。しかし、私のアプリを起動することはできません。最初の "ImageView"、2番目の "RelativeLayout" - 動作しますが、最初の "RelativeLayout"、2番目の "ImageView"はありません。

これは作品です:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical"> 
    <ImageView 
    android:id="@+id/imageview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="1" 
    /> 

    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_weight="1"> 
     <Button 
     android:id="@+id/make_photo_again" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/make_photo_again_label" 
     android:layout_alignParentLeft="true" 
     /> 
     <Button 
     android:id="@+id/edit_photo" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/edit_photo_label" 
     android:layout_alignParentRight="true" 
     /> 
    </RelativeLayout> 

</LinearLayout> 

..but私は "RelativeLayout" の下に "画像" を配置するとアプリが動作しません。

は本当になぜ、

あなたが私に言うことができる...それをどうするのか分からないのですか?

提案がありますか?

+0

にこのコードを試してみてください? – ByteMe

+0

なぜ機能しないのですか?ちょうど "それは動作しません"と言っても、あなたが得るかもしれないどんな誤りにも私たちは指摘しません。 –

+0

あなたはあなたのイメージビューを一番下または一番上にしたいです... –

答えて

0

あなたはwrap_contentの代わりにfill_parentに設定し、あなたのイメージの高さと幅を持っている理由があるXML

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

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="0dip" 
     android:layout_weight="0.3" > 

     <Button 
      android:id="@+id/make_photo_again" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentLeft="true" 
      android:text="Save" 
      /> 

     <Button 
      android:id="@+id/edit_photo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:text="Cancel" 
      /> 
    </RelativeLayout> 

    <ImageView 
     android:id="@+id/imageview" 
     android:layout_width="fill_parent" 
     android:layout_height="0dip" 
     android:layout_weight="1.7" 
     android:background="@drawable/edit_box_mytime" /> 

</LinearLayout> 
+0

ありがとう!それは良い作品です! android:contentDescription = ""をに追加するのを忘れました。 – Evmorov

0

ボタンのすぐ上の相対レイアウトの始めにイメージビューを配置し、イメージビューが背面にあり、ボタンがイメージビューに表示されるようにすると機能します。

あなたはちょうど2つのボタンの下にあなたの相対的なレイアウトの終わりにあなたのImageViewのを置く場合は、ImageViewのは前面になり、それがあなたのボタンが非表示になります.....

0

あなたのXMLが間違って見えません。あなたはどんなエラーを出していますか?記述してください。

関連する問題