Customize ListView row with ImageView & TextView

i am new to android so be patient with me please, i couldn't find the right phrase to search for posts about it, if someone can direct me to one it will be great. i am struggling in achieving this List-view row customization. below is my xml describing the List-view row that i want to achieve. what i want is a fixed location of an Image-view on the left size of the screen but with some left-margin and at the right side of the Image-view i want a Text-view which will be position on the center of the row. What happens is when the Text-view content changes the Image-view is pushed away or attached to the Text-view which is what i don't want. i would like the Image-view to stay at a fixed place without any consideration to the changing length of the Text-view which will stay on the center of the row.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="100">

<ImageView
    android:id="@+id/movieImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/selector_movie_row"
    android:gravity="center"
    android:layout_weight="20" />

<TextView
    android:id="@+id/movieName"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="16dp"
    android:textSize="30sp"
    android:textColor="@drawable/selector_movie_textview"
    android:layout_weight="80"
    android:gravity="center" />

Thanks

Answers


What you describe will be easier to achieve using RelativeLayout:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

    <ImageView
        android:id="@+id/movieImage"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/selector_movie_row"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="10dp" />

    <TextView
        android:id="@+id/movieName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:textSize="30sp"
        android:textColor="@drawable/selector_movie_textview"
        android:android:layout_toRightOf="@id/movieImage"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

Need Your Help

aspnet5 rc1 access session outside controller

session controller asp.net-core httpcontext

In .Net Framework 4.5 code, System.Web.HttpContext.Current is used,

Calling my class & method from a button in another class

c# asp.net

I have a WindowsForm that has a DataGridView that shows output of my app. The class with the button is DriveRecursion_Results.cs. I want it so that once the button is pushed by the user, my method