Strange error related to an XML file
I'm facing a strange problem and I can't figure out why I systematically get an unexpected stop of my application when I try to inflate the following XML file in the onCreateView
of my class which extends the Fragment
class :
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/fond_application_horizontal">
<Button
android:id="@+id/ZoomPlusY"
android:layout_height="140dip"
android:layout_width="40dip"
android:text="Y+">
</Button>
<Button
android:id="@+id/ZoomMoinsY"
android:layout_height="140dip"
android:layout_width="40dip"
android:layout_below="@id/ZoomPlusY"
android:text="Y-">
</Button>
<Button
android:id="@+id/ZoomOptimum"
android.layout.width="70dip"
android.layout.height="40dip"
android:layout_below="@id/ZoomMoinsY"
android:text="Opt">
</Button>
<开发者_如何学Go/RelativeLayout>
If I suppress the third button, the XML file is perfectly inflated and the application doesn't crash.
Any idea?
Thanks in advance for the time you will spend trying to help me.
You should probably include your logcat traceback, but immediately at looking at your layout I see at least one problem:
android.layout.width="70dip"
android.layout.height="40dip"
Those property names should be android:layout_height
and android:layout_width
.
Also, android:orientation
is meaningless on a RelativeLayout
.
Why are you using the dot syntax
in your third button android.layout.width
? It is a copy error or this is how your XML realy looks like?
精彩评论