I just faced to a weired problem in Android. That is, I created my project in eclipse using default settings. Eclipse has applied “Android 2.3.3 (API10) as the “Build SDK” and “API8:Android 2.2 (Froyo)” as the “Minimum required SDK.
However, I asked a question here and they have asked me to use the attribute “android:layout_toRightOf” but that attribute wasn’t available!! Following were the attributes available which starts with android:layout_, they are width, height, weight, gravity, margin, marginLeft, marginTop, marginRight and marginBottom.
However, then I opened another project with “Android 2.3.3 (API10) as the “Build SDK” and the same as the “Minimum required SDK”. Now, those attributes are there!!
Why is this? Do I have to select the same API as the build sdk and minimum required sdk? Please help!
EDIT
Following code has those attributes, which didn’t appear when I am trying to use at the first time
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<TextView
android:id="@+id/firstTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/firstNumber"
android:alignParentLeft="true"
android:alignParentTop="true"
/>
<EditText
android:id="@+id/firstNumberTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:toRightOf="@+id/firstTextView"
android:marginLeft=30dp
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/secondNumber"
android:alignLeft="@+id/firstTextView"
android:below="@+id/firstTextView"
/>
<EditText
android:id="@+id/secondNumberTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alignLeft="@+id/firstNumberTxt"
android:below="@+id/firstTextView"
/>
<RadioGroup
android:id="@+id/radioGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<RadioButton
android:id="@+id/sum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/sum"
/>
<RadioButton
android:id="@+id/min"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/min"
/>
<RadioButton
android:id="@+id/max"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/max"
/>
<RadioButton
android:id="@+id/dev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dev"
/>
</RadioGroup>
Are you using a RelativeLayout? toRightOf is only available in that kind of layouts!