makthrow
makthrow

Reputation: 139

How to position this in a coordinator layout?

I'm struggling with making a coordinator layout work. Can someone help me with this?

I just want a simple layout of :

NameLabel, AgeLabel

(Below) Profile pic

(Below) TextLabel (Below) ImageView

instead I get this: and my ageLabel and nameLabel are god knows where. enter image description here

<android.support.design.widget.CoordinatorLayout 
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:id="@+id/activity_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".HomeActivity">

<include
    layout="@layout/toolbar_main"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    />


    <com.android.volley.toolbox.NetworkImageView
        android:id="@+id/home_fb_pic_thumbnail"
        android:layout_width="120dp"
        android:layout_height="120dp"
        android:layout_gravity="top|center"
    />

    <TextView
        android:id="@+id/nameTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="name" />

    <TextView
        android:id="@+id/ageTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="age" />


<ImageButton
        android:id="@+id/imageButton"
        android:layout_width="248dp"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_gravity="bottom"
        android:onClick="startRecording"
        app:srcCompat="@drawable/intro_camera_2" />

    <TextView
        android:id="@+id/introductionTextView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center"
        android:text="Introduce Yourself! Video Introductions Last 24 Hours"
        android:textAppearance="@android:style/TextAppearance.Material.Medium" />

Upvotes: 0

Views: 2280

Answers (1)

Nobody
Nobody

Reputation: 420

Those two text views will appear in the design tab if you can notice. But the problem is you haven't specified any constraints as to their placement like you have done for your other views. Place constraints to position them on screen where you want it to for example set left, right,top and bottom margins or align it below some images you already have.Hope that helps.

Upvotes: 1

Related Questions