October 2018
Intermediate to advanced
464 pages
15h 17m
English
In contrast to what we saw earlier, here is an example using LinearLayout just to center TextView (creating the same effect as the layout_center parameter of RelativeLayout):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<TextView
android:id="@+id/imageButton_speak"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Centered" />
</LinearLayout>
</LinearLayout>
Notice ...