jeudi 5 novembre 2015

Dividing Layout vertically in two equal parts

Vote count: 0

I am trying to create a layout file where i have to divide the screen into 2 equal parts. I have spent lot of time to do this.But i am not able to achieve it.

I checked this post also

How to split the screen with two equal LinearLayouts?

How to divide screen into three parts vertically?

Still I was not able to achieve it.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout  xmlns:android="http://ift.tt/nIICcg"
 xmlns:app="http://ift.tt/GEGVYd"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@color/profileImBg"
        android:orientation="horizontal"
        >


        <ImageView
            android:id="@+id/profileIm"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:src="@drawable/profileImage" />


    </LinearLayout>

    <android.support.v7.widget.CardView
        android:id="@+id/card_view"
        style="@style/cardStyle"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <android.support.v7.widget.GridLayout
            android:id="@+id/buttonGrid"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="16dp"
            android:layout_marginLeft="16dp"
            android:layout_marginRight="16dp"
            android:layout_marginTop="16dp"

            app:columnCount="2"
            app:rowCount="2">

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:text="Name"
                android:textColor="#757575"
                android:textSize="16sp"
                app:layout_column="0"
                app:layout_columnWeight="1"
                app:layout_row="0"

                />


            <TextView
                android:id="@+id/name"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="8dp"
                android:textColor="#757575"
                android:textSize="20sp"
                app:layout_column="1"
                app:layout_columnWeight="1"
                app:layout_row="0" />

            <TextView
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_marginBottom="8dp"
                android:layout_marginRight="8dp"
                android:text="Contact Number"
                android:textColor="#757575"
                android:textSize="16sp"
                app:layout_column="0"
                app:layout_columnWeight="1"
                app:layout_row="1"

                />


            <TextView
                android:id="@+id/contactNumber"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_alignParentRight="true"
                android:layout_marginBottom="8dp"
                android:layout_marginLeft="8dp"
                android:textColor="#757575"
                android:textSize="20sp"
                app:layout_column="1"
                app:layout_columnWeight="2"
                app:layout_row="1" />






        </android.support.v7.widget.GridLayout>

    </android.support.v7.widget.CardView>

</LinearLayout>

asked 2 mins ago
Zero
101

This entry passed through the Full-Text RSS service - if this is your content and you're reading it on someone else's site, please read the FAQ at http://ift.tt/jcXqJW.



Dividing Layout vertically in two equal parts

Aucun commentaire:

Enregistrer un commentaire