2012-05-04 50 views
1

我需要使用show first按钮,而不仅仅是一张图片。但我的应用程序无法启动。首先“ImageView”,第二个“RelativeLayout” - 工作,但首先“RelativeLayout”,第二个“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> 

..但如果我把“图片”下的“RelativeLayout的”应用程序无法正常工作。

真的不知道该怎么做..

你能告诉我,为什么?

有什么建议吗?

+0

有你有你的图像设置为FILL_PARENT代替WRAP_CONTENT高度和宽度的原因是什么? – ByteMe

+0

它为什么不起作用?只是说“它不起作用”并不意味着我们可能会遇到任何错误。 –

+0

你想要你的imageview在底部或顶部... –

回答

0

尝试在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

它应该工作,如果你把你的imageview在你的相对布局刚开始的按钮上方,然后imageview将在背面和按钮将在imageview。

如果你把你在你的相对布局结束ImageView的正下方两个按键则imageview的将是在前面,它会隐藏按钮.....

0

你的XML并没有看错。你得到了什么错误。请描述。

相关问题