Android is there a way to have a list box with a set size, instead of filling the parent or content? -


i have textview on top if more 5 lines of text, scroll. list of text on bottom files remain space.

i'm using scrollview textview inside. problem if set top scroll warp content, keep getting bigger if there more 5 lines of text. if set fill parent, button text view not displayed. there way this?

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical" >      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="tell furtune chat"         android:textsize="38px" />      <scrollview         android:layout_width="fill_parent"         android:layout_height="wrap_content" >          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="tell furtune \n ted \n teda \n rob \n fred \n bed \n jack \n junk \n more"             android:textsize="38px" />     </scrollview>      <scrollview         android:layout_width="fill_parent"         android:layout_height="wrap_content" >          <textview             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="tell furtune \n ted \n teda \n rob \n fred \n bed \n jack \n junk \n more"             android:textsize="38px" />     </scrollview>  </linearlayout> 

if understand question, use attribute:

<textview     ...     android:maxlines="5" /> 

also, if scrollviews "pushing" other views off bottom of screen can limit height this:

<scrollview     ...     android:height="100dp" > 

addition

from documentation:

edittext thin veneer on textview configures editable.

however in case: maxlines behaves in 2 different manners. seemed remember textview scroll automatically after defining maxlines edittexts use on regular basis. (what crazy thought!) anyway, easiest way achieve want:

<scrollview     android:layout_width="wrap_content"     android:layout_height="90sp" >      <textview         android:id="@+id/text"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         ... /> </scrollview> 

where scrollview's height ratio of font size how many row want displayed. can use maxlines attribute described here ( making textview scrollable on android ), solution not support fling gestures , creates "blink" effect whenever user scrolls.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -