开发者

TextView not resizeable

I have a TextView in a ScrollView with a specific background image. My problem is that if the text is longer than one line, the TextView will stretch as much as the screen allows it. I would like the text view's sizes to remain the same (the sizes of the background)

<ScrollView android:id="@+id/description"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"
    开发者_开发问答android:layout_marginLeft="@dimen/padding_large"
    >
    <TextView
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:paddingTop="@dimen/padding"
        android:paddingBottom="@dimen/padding"
        android:paddingLeft="@dimen/padding_large"
        android:paddingRight="@dimen/padding_large"
        android:background="@drawable/textfield_background_small"
        android:inputType="textMultiLine"
        android:text="@string/step_description"
      />
 </ScrollView>


Using wrap_content makes a layout dynamic, i.e. its size will grow and shrink depending on its content. If you instead change all your wrap_content to fill_parent the layouts will fill their parent container entirely.

You can read more about how to properly declare layouts here: http://developer.android.com/guide/topics/ui/declaring-layout.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜