android - Align ImageView to right of it`s parent layout which is LinearLayout -


i want align imageview right(end) side of it`s parent layout, compulsory linearlayout. not recommended use relativelayout anywhere. shown in below image, highlighted image should right side of screen. , without using relativelayout. in advance.

image here

below activity_main.xml code

    <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:weightsum="4"     tools:context="com.pinchzoom.pinchzoomexampletwo.mainactivity" >      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="0.5"         android:gravity="center_vertical"         android:orientation="horizontal" >          <imageview             android:id="@+id/img_back"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:contentdescription="@string/img_back_description"             android:src="@drawable/back_icon" />          <textview             android:id="@+id/txt_app_name"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/txt_app_name" />          <imageview             android:id="@+id/img_menu"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:contentdescription="@string/img_menu_description"             android:src="@drawable/menu_icon" />     </linearlayout>      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="3"         android:orientation="horizontal"         android:weightsum="2" >          <com.pinchzoom.pinchzoomexampletwo.touchimageview             android:id="@+id/img_to_be_zoomed"             android:layout_width="wrap_content"             android:layout_height="fill_parent"             android:layout_weight="1"             android:src="@drawable/img" >         </com.pinchzoom.pinchzoomexampletwo.touchimageview>          <com.pinchzoom.pinchzoomexampletwo.touchimageview             android:id="@+id/img_to_be_zoomed_mirror"             android:layout_width="wrap_content"             android:layout_height="fill_parent"             android:layout_weight="1"             android:src="@drawable/img" >         </com.pinchzoom.pinchzoomexampletwo.touchimageview>     </linearlayout>      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="0.5"         android:gravity="center_vertical"         android:orientation="horizontal" >          <textview             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:gravity="center_horizontal"             android:text="@string/txt_view_top" />     </linearlayout>      <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_weight="0.25"         android:gravity="center"         android:orientation="horizontal" >          <button             android:id="@+id/btn_gallery"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/btn_label_gallery" />     </linearlayout>  </linearlayout> 

try way , change want put that. change in layout_weight until not want. hope u more.

<linearlayout     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:gravity="center_vertical"     android:orientation="horizontal" >      <imageview         android:id="@+id/img_back"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="0.5"         android:contentdescription="@string/img_back_description"         android:src="@drawable/back_icon" />      <textview         android:id="@+id/txt_app_name"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="1"         android:text="@string/txt_app_name" />      <imageview         android:id="@+id/img_menu"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="0.5"         android:contentdescription="@string/img_menu_description"         android:src="@drawable/menu_icon" /> </linearlayout> 

happy codeing


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -