android - Textview maxlines depends on its height -


i have textview height depends on size of height of imageview, , image's width 30% of screen size. set textview maxlines=2 , ellipsize=end. works in nexus s not in larger screen such nexus 7 because maxlines keep 2 not larger. how make maxlines larger depends on screen size?

nexus s

nexus s

nexus 7

enter image description here

and code

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.constraintlayout     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:layout_width="match_parent"     android:layout_height="match_parent"     android:layout_orientation="vertical">      <textview         android:id="@+id/tvname"         android:layout_width="0dp"         android:layout_height="wrap_content"         android:text="nama"         android:textsize="24sp"         android:textstyle="bold"         android:layout_marginright="8dp"         app:layout_constraintright_torightof="parent"         app:layout_constraintleft_torightof="@+id/ivphotoprofile"         android:layout_marginleft="8dp"         app:layout_constrainttop_totopof="parent"         android:layout_margintop="8dp"         app:layout_constrainthorizontal_bias="0.0"/>      <textview         android:id="@+id/tvusername"         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_marginleft="0dp"         android:layout_marginright="0dp"         android:layout_margintop="-1dp"         android:text="username"         android:textsize="12sp"         app:layout_constraintleft_toleftof="@+id/tvname"         app:layout_constraintright_torightof="@+id/tvname"         app:layout_constrainttop_tobottomof="@+id/tvname"/>      <textview         android:id="@+id/tvbio"         android:layout_width="0dp"         android:layout_height="0dp"         android:layout_marginbottom="0dp"         android:layout_marginleft="0dp"         android:layout_marginright="0dp"         android:layout_margintop="2dp"         android:ellipsize="end"         android:maxlines="2"         android:text="@string/lorem_ipsum"         android:textsize="14sp"         app:layout_constraintbottom_tobottomof="@+id/ivphotoprofile"         app:layout_constrainthorizontal_bias="0.0"         app:layout_constraintleft_toleftof="@+id/tvusername"         app:layout_constraintright_torightof="@+id/tvusername"         app:layout_constrainttop_tobottomof="@+id/tvusername"/>      <imageview         android:id="@+id/ivphotoprofile"         android:layout_width="0dp"         android:layout_height="0dp"         android:layout_marginleft="8dp"         android:layout_marginright="0dp"         android:layout_margintop="8dp"         android:adjustviewbounds="true"         android:scaletype="fitcenter"         app:layout_constraintdimensionratio="1:1"         app:layout_constraintleft_toleftof="parent"         app:layout_constraintright_toleftof="@+id/guideline2"         app:layout_constrainttop_totopof="parent"         app:srccompat="@drawable/profile_picture_default"/>      <android.support.constraint.guideline         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:id="@+id/guideline2"         android:orientation="vertical"         app:layout_constraintguide_percent="0.30625"/>  </android.support.constraint.constraintlayout> 

try remove below line <textview android:id="@+id/tvbio" ... xml:-

app:layout_constraintbottom_tobottomof="@+id/ivphotoprofile" 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -