微调扩大,超出屏幕范围 [英] spinner expanding beyond screen bounds

查看:152
本文介绍了微调扩大,超出屏幕范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含三行一TableLayout布局。每一行都有一个TextView和一个微调。纱厂列设置为拉伸。我的问题是,纺纱被拉伸了屏幕的边缘时,它们包含一个长的字符串。我想他们截断字符串代替。这里的问题的截图:

http://www.comicfanboy.net/images/screenshot.png

和这里的XML的布局:

 <滚动型
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID / settings_scrollview
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =FILL_PARENT
    机器人:layout_gravity =center_horizo​​ntal>
    <的LinearLayout机器人:ID =@ + ID / linearLayout1机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT机器人:方向=垂直机器人:以下属性来=3DP机器人:paddingRight =3DP&GT ;
        < TextView的机器人:ID =@ + ID / textView1机器人:layout_height =WRAP_CONTENT机器人:文本=@字符串/ general_information_defaults机器人:重力=center_horizo​​ntal机器人:layout_width =FILL_PARENT>< / TextView的>
        < TableLayout安卓layout_height =WRAP_CONTENT机器人:ID =@ + ID / tableLayout1机器人:layout_width =FILL_PARENT机器人:stretchColumns =1>
            <的TableRow机器人:ID =@ + ID / tableRow1机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT>
                < TextView的机器人:ID =@ + ID / textView2机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT安卓重力=右| center_vertical机器人:文本=微调标签1>< / TextView的>
                <微调机器人:layout_height =WRAP_CONTENT机器人:ID =@ + ID / default_organization_spinner机器人:layout_width =WRAP_CONTENT>< /微调>
            < /的TableRow>
            <的TableRow机器人:ID =@ + ID / tableRow2机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT>
                < TextView的机器人:ID =@ + ID / TextView01机器人:layout_width =FILL_PARENT机器人:layout_height =FILL_PARENT安卓重力=右| center_vertical机器人:文本=微调标签2>< / TextView的>
                <微调的android:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT机器人:ID =@ + ID / default_sport_spinner>< /微调>
            < /的TableRow>
            <的TableRow机器人:ID =@ + ID / tableRow3机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT>
                < TextView的机器人:ID =@ + ID / TextView02机器人:重力=右| center_vertical机器人:layout_height =FILL_PARENT机器人:layout_width =FILL_PARENT机器人:文本=微调标签3>< / TextView的>
                <微调的android:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT机器人:ID =@ + ID / default_injury_spinner>< /微调>
            < /的TableRow>
        < / TableLayout>
        < TextView的Andr​​oid的:layout_width =FILL_PARENT机器人:ID =@ + ID / TextView03机器人:重力=center_horizo​​ntal机器人:layout_height =WRAP_CONTENT机器人:文本=@字符串/ email_defaults机器人:paddingTop = 20dp>< / TextView的>
        < TableLayout机器人:layout_width =FILL_PARENT机器人:layout_height =WRAP_CONTENT机器人:ID =@ + ID / TableLayout01机器人:stretchColumns =1>
            <的TableRow机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT机器人:ID =@ + ID / TableRow02>
                < TextView的Andr​​oid版本:layout_height =FILL_PARENT机器人:ID =@ + ID / TextView04机器人:重力=右| center_vertical机器人:layout_width =FILL_PARENT机器人:文本=@字符串/以>&LT ; / TextView的>
                < EditText上安卓inputType =textEmailAddress机器人:layout_height =WRAP_CONTENT机器人:layout_width =WRAP_CONTENT机器人:ID =@ + ID / default_to_field>
                    < requestFocus的>< / requestFocus的>
                < /的EditText>
            < /的TableRow>
            <的TableRow机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT机器人:ID =@ + ID / TableRow01>
                < TextView的Andr​​oid版本:layout_height =FILL_PARENT机器人:ID =@ + ID / TextView06机器人:重力=右| center_vertical机器人:layout_width =FILL_PARENT机器人:文本=@字符串/ CC>&LT ; / TextView的>
                < EditText上安卓inputType =textEmailAddress机器人:layout_height =WRAP_CONTENT机器人:layout_width =WRAP_CONTENT机器人:ID =@ + ID / default_cc_field>< /的EditText>
            < /的TableRow>
        < / TableLayout>
        < TextView的Andr​​oid的:layout_width =FILL_PARENT机器人:ID =@ + ID / TextView05机器人:重力=center_horizo​​ntal机器人:layout_height =WRAP_CONTENT机器人:文本=@字符串/ program_options机器人:paddingTop = 20dp>< / TextView的>
        <复选框机器人:layout_width =WRAP_CONTENT机器人:layout_height =WRAP_CONTENT机器人:layout_gravity =center_horizo​​ntal机器人:以下属性来=40dp机器人:ID =@ + ID / auto_sync_checkbox机器人:文本=@字符串/ auto_sync_at_login>< /复选框>
    < / LinearLayout中>
< /滚动型>
 

解决方案

Android的:layout_width =100dip的微调利用该标签

I have a layout that contains a TableLayout with three rows. Each row has a TextView and a Spinner. The Spinners' column is set to stretch. My problem is that the Spinners are stretching off the edge of the screen when they contain a long string. I would like them to truncate the string instead. Here's a screenshot of the problem:

http://www.comicfanboy.net/images/screenshot.png

and here's the xml for the layout:

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/settings_scrollview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_horizontal">
    <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:paddingLeft="3dp" android:paddingRight="3dp">
        <TextView android:id="@+id/textView1" android:layout_height="wrap_content" android:text="@string/general_information_defaults" android:gravity="center_horizontal" android:layout_width="fill_parent"></TextView>
        <TableLayout android:layout_height="wrap_content" android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:stretchColumns="1">
            <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="right|center_vertical" android:text="Spinner Label 1"></TextView>
                <Spinner android:layout_height="wrap_content" android:id="@+id/default_organization_spinner" android:layout_width="wrap_content"></Spinner>
            </TableRow>
            <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:id="@+id/TextView01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="right|center_vertical" android:text="Spinner Label 2"></TextView>
                <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/default_sport_spinner"></Spinner>
            </TableRow>
            <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:id="@+id/TextView02" android:gravity="right|center_vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" android:text="Spinner Label 3"></TextView>
                <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/default_injury_spinner"></Spinner>
            </TableRow>
        </TableLayout>
        <TextView android:layout_width="fill_parent" android:id="@+id/TextView03" android:gravity="center_horizontal" android:layout_height="wrap_content" android:text="@string/email_defaults" android:paddingTop="20dp"></TextView>
        <TableLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/TableLayout01" android:stretchColumns="1">
            <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/TableRow02">
                <TextView android:layout_height="fill_parent" android:id="@+id/TextView04" android:gravity="right|center_vertical" android:layout_width="fill_parent" android:text="@string/to"></TextView>
                <EditText android:inputType="textEmailAddress" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/default_to_field">
                    <requestFocus></requestFocus>
                </EditText>
            </TableRow>
            <TableRow android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/TableRow01">
                <TextView android:layout_height="fill_parent" android:id="@+id/TextView06" android:gravity="right|center_vertical" android:layout_width="fill_parent" android:text="@string/cc"></TextView>
                <EditText android:inputType="textEmailAddress" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/default_cc_field"></EditText>
            </TableRow>
        </TableLayout>
        <TextView android:layout_width="fill_parent" android:id="@+id/TextView05" android:gravity="center_horizontal" android:layout_height="wrap_content" android:text="@string/program_options" android:paddingTop="20dp"></TextView>
        <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:paddingLeft="40dp" android:id="@+id/auto_sync_checkbox" android:text="@string/auto_sync_at_login"></CheckBox>
    </LinearLayout>
</ScrollView>

解决方案

android:layout_width="100dip" Use this tag in the spinner.

这篇关于微调扩大,超出屏幕范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆