Problems in TableLayout for custom ListView in Android -


in android app i'm retrieving data server using json. display data, i'm using custom listview has 3 static images , 2 textviews. data displaying in listview in different manner. image1

i want output this image. output list different in numbers go missing list. image2 here after 104, numbers 105 , 106 missing , 110 missing. not getting idea why output this. here's xml layout code below:

xml code

<?xml version="1.0" encoding="utf-8"?> <tablelayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="horizontal"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:stretchcolumns="0,1,2"     android:shrinkcolumns="1"     android:layout_marginleft="10dp">      <tablerow         android:layout_width="match_parent">         <textview             android:id="@+id/srno"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:paddingbottom="5dp"             android:text="sr no."             android:textcolor="#000000"             android:singleline="true"             android:layout_margintop="10dp"/>          <textview             android:id="@+id/name"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:text="expert name here."             android:textcolor="#000000"             android:paddingbottom="5dp"             android:gravity="center"             android:layout_margintop="10dp"/>         <linearlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:gravity="right">              <imageview                 android:id="@+id/edit"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:src="@android:drawable/ic_menu_view"                 android:paddingbottom="5dp"                 android:layout_margintop="5dp"/>              <imageview                 android:id="@+id/view"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:src="@android:drawable/ic_menu_edit"                 android:paddingbottom="5dp"                 android:layout_margintop="5dp"/>              <imageview                 android:id="@+id/delete"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:src="@android:drawable/ic_menu_delete"                 android:paddingbottom="5dp"                 android:layout_margintop="5dp"/>          </linearlayout>      </tablerow> </tablelayout> 

you've been there within discussion @sangeeta.

since tablerow inherited linearlayout concept of weight valid too, according layout_width attribute has set 0dp in order view spreaded horizontally.

the following needs changed:

  1. remove android:stretchcolumns="0,1,2"
  2. set android:layout_width="0dp" wherever layout_weight attribute used.

(note: left relevant attributes question)

<?xml version="1.0" encoding="utf-8"?> <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:shrinkcolumns="1">  <tablerow     android:layout_width="match_parent">     <textview         android:id="@+id/srno"         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_weight="0.25"/>      <textview         android:id="@+id/name"         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_weight="0.5"/>      <linearlayout         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_weight="0.25">          <imageview             android:id="@+id/edit"             android:layout_width="wrap_content"             android:layout_height="wrap_content"/>          <imageview             android:id="@+id/view"             android:layout_width="wrap_content"             android:layout_height="wrap_content"/>          <imageview             android:id="@+id/delete"             android:layout_width="wrap_content"             android:layout_height="wrap_content"/>      </linearlayout>  </tablerow> </tablelayout> 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -