xml - Android TextView Right Side -


i trying set imageview in left side , text view right side in linearlayout. not able set textview end of linearlayout. how can ?enter image description here

i want name on end of linearlayout in line of imageview.

my xml below.

<linearlayout                  android:layout_gravity="center_horizontal"                  android:layout_marginbottom="12dp"                  android:orientation="horizontal"                  android:layout_width="match_parent"                  android:layout_height="wrap_content"                  android:layout_weight="1">                        <imageview                          android:id="@+id/action_qod_save"                          android:src="@android:drawable/ic_menu_save"                          android:layout_width="wrap_content"                          android:layout_height="wrap_content" />                    <textview                      android:id="@+id/txtusername"                      android:layout_height="match_parent"                      android:layout_width="wrap_content"                      android:textsize="18sp"                      android:text="your name"                      android:gravity="center"                      android:layout_gravity="left"                      android:textstyle="italic"                      android:typeface="sans"                      android:textcolor="@android:color/black"/>                </linearlayout>

full xml

<?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:id="@+id/coordinatorlayout"      android:layout_width="match_parent"      android:layout_height="match_parent"      android:background="#ffeeeeee"      >          <android.support.v7.widget.cardview          android:layout_centerinparent="true"          android:layout_margin="24dp"          app:cardcornerradius="24dp"          android:elevation="8dp"          android:layout_width="match_parent"          android:layout_height="wrap_content"          >              <linearlayout                android:paddingtop="16dp"              android:orientation="vertical"              android:layout_width="match_parent"              android:layout_height="wrap_content"              android:weightsum="1">                  <linearlayout                  android:layout_width="match_parent"                  android:layout_height="wrap_content"                  android:gravity="center"                  android:orientation="vertical">                    <linearlayout                      android:layout_width="match_parent"                      android:layout_height="wrap_content"                      android:gravity="center">                      <com.mikhaellopez.circularimageview.circularimageview                          android:id="@+id/imgview"                          android:layout_width="128dp"                          android:layout_height="128dp"                          android:src="@drawable/ic_launcher"                          app:civ_border_color="#eeeeee"                          app:civ_border_width="4dp"                          app:civ_shadow="true"                          app:civ_shadow_radius="10"                          app:civ_shadow_color="@color/colorprimary"/>                  </linearlayout>                    <textview                      android:background="@color/white"                      android:id="@+id/txtquote"                      android:layout_height="wrap_content"                      android:layout_width="match_parent"                      android:padding="8dp"                      android:textsize="19dp"                      android:gravity="center"                      android:textstyle="italic"                      android:typeface="sans"                      android:lines="5"                      android:textcolor="@color/colorprimarydark"                      android:text="quote of day text here">                  </textview>                </linearlayout>                  <linearlayout                  android:layout_gravity="center_horizontal"                  android:layout_marginbottom="12dp"                  android:orientation="horizontal"                  android:layout_width="match_parent"                  android:layout_height="wrap_content"                  android:layout_weight="1">                        <imageview                          android:id="@+id/action_qod_save"                          android:src="@drawable/new_share_btn"                          android:layout_width="36dp"                          android:layout_height="36dp" />                    <textview                      android:id="@+id/txtusername"                      android:layout_height="match_parent"                      android:layout_width="wrap_content"                      android:textsize="18sp"                      android:text="your name"                      android:gravity="center"                      android:layout_gravity="left"                      android:textstyle="italic"                      android:typeface="sans"                      android:textcolor="@color/colorprimarydark"/>                </linearlayout>                  <textview                    android:background="@color/colorprimary"                  android:id="@+id/lbltitle"                  android:layout_height="wrap_content"                  android:layout_width="match_parent"                  android:padding="10dp"                  android:gravity="center"                  android:textstyle="bold"                  android:textsize="24sp"                  android:shadowcolor="@android:color/white"                  android:shadowdx="-5"                  android:shadowdy="-5"                  android:shadowradius="2"                  android:textcolor="#ffffff"                  android:text="status of day">                </textview>            </linearlayout>          </android.support.v7.widget.cardview>        </relativelayout>

thanks

use this

<relativelayout              android:layout_marginbottom="12dp"              android:layout_width="match_parent"             android:layout_height="wrap_content"            >                  <imageview                     android:id="@+id/action_qod_save"                     android:src="@android:drawable/ic_menu_save"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content" />              <textview                 android:id="@+id/txtusername"                 android:layout_height="match_parent"                 android:layout_width="wrap_content"                 android:textsize="18sp"                 android:text="your name"                 android:textstyle="italic"                 android:typeface="sans"                 android:textcolor="@android:color/black"                  android:layout_alignparentright="true"/>          </relativelayout> 

if want linear layout this

<linearlayout             android:layout_gravity="center_horizontal"             android:layout_marginbottom="12dp"             android:orientation="horizontal"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_weight="1">                  <imageview                     android:id="@+id/action_qod_save"                     android:src="@android:drawable/ic_menu_save"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content" />        <view       android:layout_width="wrap_content"                     android:layout_height="wrap_content"        android:layout_weight="1"             />             <textview                 android:id="@+id/txtusername"                 android:layout_height="match_parent"                 android:layout_width="wrap_content"                 android:textsize="18sp"                 android:text="your name"                 android:gravity="center"                 android:layout_gravity="left"                 android:textstyle="italic"                 android:typeface="sans"                 android:textcolor="@android:color/black"/>          </linearlayout> 

but not suggested place empty view in between


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -