C
C
Chesterfield252020-03-26 00:27:21
XML
Chesterfield25, 2020-03-26 00:27:21

How to center align text and button?

How to center align text and button?

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <LinearLayout
        android:id="@+id/Line1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:orientation="vertical">

        <ScrollView
            android:id="@+id/Scroll"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="none"
            android:layout_marginBottom="60dp">

            <LinearLayout
                android:id="@+id/Line2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:padding="20dp"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/text"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="@string/text"
                    android:textColor="@color/colorBlack"
                    android:textSize="18sp" />

                <ImageButton
                    android:id="@+id/button"
                    android:layout_width="150dp"
                    android:layout_height="150dp"
                    android:background="@null"
                    android:scaleType="fitCenter"
                    app:srcCompat="@drawable/ic_mic" />

            </LinearLayout>
        </ScrollView>

    </LinearLayout>

    <LinearLayout
        android:id="@+id/Line3"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_alignParentBottom="true"
        android:orientation="horizontal">

        <ImageView
            android:id="@+id/banners"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:layout_weight="1"
            app:srcCompat="@drawable/freebanner4" />
    </LinearLayout>
</RelativeLayout>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question