performance - Show images or video or text in ListView in Android -


i trying understand best in case have listview , set text content on textview. there can photo type or video, still have textview in row. should best, have "just in case" imageview , videoview , show them when it's case? thinking of performance well. being custom adapter, least of logic faster render.

this row xml:

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:background="@android:color/transparent"     android:orientation="vertical" >      <relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:padding="@dimen/activity_horizontal_margin" >          <com.pubble.moderator.utils.circleimageview             android:id="@+id/author_icon"             android:layout_width="36dp"             android:layout_height="36dp"             android:background="@drawable/ic_account_circle_white_64dp"             android:scaletype="centercrop" />          <textview             android:id="@+id/author_name"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_torightof="@id/author_icon"             android:gravity="left"             android:paddingleft="@dimen/activity_horizontal_margin"             android:textcolor="@android:color/darker_gray" />          <textview             android:id="@+id/author_msg"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_below="@id/author_name"             android:layout_torightof="@id/author_icon"             android:inputtype="textmultiline"             android:paddingleft="@dimen/activity_horizontal_margin"             android:textcolor="@color/chat_black"             android:textsize="@dimen/text_size_14" >         </textview>          <textview             android:id="@+id/answer_time"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_alignright="@+id/author_name"             android:layout_aligntop="@+id/author_name"             android:paddingleft="@dimen/activity_horizontal_margin"             android:textcolor="@android:color/darker_gray"             android:textsize="12sp" />     </relativelayout>  </relativelayout> 

in custom adapter extends arrayadapter<chat> implements filterable

i have :

linkify.addlinks(holder.msgtxt, linkify.all); holder.msgtxt.setautolinkmask(linkify.web_urls); holder.msgtxt.setmovementmethod(linkmovementmethod.getinstance()); 

but if content it's photo or video type, best do? hide holder.msgtxt , show appropriate component can consume content? don't know, really. ideas welcomed. thank you.

recyclerview seems option.

check link : https://developer.android.com/training/material/lists-cards.html


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 -