主要使用:
完全在父节点的左侧:android:layout_alignParentLeft ="true"
在某ID的左侧:android:layout_toLeftOf ="@+id/la_praise_icon"
在某ID的右侧:android:layout_toRightOf ="@+id/la_praise_icon"
完全在父节点的右侧:android:layout_alignParentRight ="true"
具体布局参考代码:
<?xml version ="1.0" encoding= "utf-8"?>
<RelativeLayout xmlns:android ="http://schemas.android.com/apk/res/android"
xmlns:fontawesometext ="http://schemas.android.com/apk/res-auto"
android:layout_width ="match_parent"
android:layout_height ="match_parent"
>
<com.beardedhen.androidbootstrap.FontAwesomeText
android:id ="@+id/la_qq_icon"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_alignParentLeft ="true"
android:layout_margin ="10dp"
android:textSize ="32sp"
fontawesometext:fa_icon ="fa-qq" />
<TextView
android:id ="@+id/la_text_qqNum"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_margin ="2dp"
android:layout_toRightOf ="@+id/la_qq_icon"
android:textSize ="32sp" />
<com.beardedhen.androidbootstrap.FontAwesomeText
android:id ="@+id/la_praise_icon"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_margin ="10dp"
android:layout_toRightOf ="@+id/la_text_qqNum"
android:textSize ="32sp"
fontawesometext:fa_icon ="fa-thumbs-o-up" />
<TextView
android:id ="@+id/la_text_praiseNum"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_margin ="5dp"
android:layout_toRightOf ="@+id/la_praise_icon"
android:textSize ="32sp" />
<com.beardedhen.androidbootstrap.FontAwesomeText
android:id ="@+id/la_right_icon"
android:layout_width ="wrap_content"
android:layout_height ="wrap_content"
android:layout_margin ="5dp"
android:textSize ="32sp"
fontawesometext:fa_icon ="fa-caret-left"
android:layout_alignParentRight ="true"
/>
</RelativeLayout >