What is the difference android:layout_alignParentRight and android:layout_alignRight?It doesnt make me any sense?
My code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="320dip"
android:background="@drawable/merhaba_bg_320_480dip">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320dip"
android:layout_height="480dip" >
**<ImageView
android:layout_height="30dip"
android:layout_width="64dip"
android:id="@+id/merhaba_btn_nedir"
android:background="@drawable/merhaba_btn_nedir_64_30dip"
android:layout_margin="5dip"
android:layout_alignRight="@id/bla">
</ImageView>**
<RelativeLayout
android:layout_height="44dip"
android:layout_width="320dip"
android:background="@drawable/merhaba_header_320_44dip"
**android:id="@+id/bla**">
<ImageView
android:layout_height="32dip"
android:layout_width="121dip"
android:background="@drawable/merhaba_logo_121_32dip"
android:layout_centerInParent="true">
</ImageView>
<ImageView
android:layout_height="30dip"
android:layout_width="64dip"
android:background="@drawable/merhaba_btn_nedir_64_30dip"
android:layout_margin="5dip"
android:layout_alignParentRight="true">
</ImageView>
</RelativeLayout>
</LinearLayout>
</ScrollView>
Accepts a boolean value, and if set to
true, it’ll make the right edge of this view match the right edge of the parent.Accepts an id (reference to another view in the same view group), and makes the right edge of this view match the right edge of the given anchor view.
In other words: the first allows you to position a view relative to its parent, whereas the second positions a view relative to some other view (which should be a sibling view in the same parent). There are similar attributes for left, top and bottom.
Visualizing things usually helps a lot – just try some different variations of both and watch their results in Eclipse’s layout editor.