myc_100 2012-10-12 09:29 采纳率: 10%
浏览 2865
已采纳

表格行中编辑框的问题

在表格行中有一个文本框和一个编辑框,问题是当我在编辑框中输入字符时,编辑框中不显示我输入的内容,好像是编辑框宽度的问题。那么如何实现在输入字符时编辑框可以多行显示内容或者出现滚动条呢?
代码是这样的:

<TableLayout
    android:id="@+id/table"
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:paddingTop="30dip"
    android:paddingLeft="10dip"
    android:paddingRight="10dip"
    android:layout_below="@id/banner" >
    <TableRow>
        <TextView
            android:id="@+id/username_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#fff"
            android:textSize="18dip" 
            android:text="Username"
             />
        <EditText
            android:id="@+id/entry1"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
    </TableRow>

    <TableRow>
        <TextView
            android:id="@+id/password_label"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:textColor="#fff"
            android:textSize="18dip" 
            android:text="Password" />
        <EditText
            android:id="@+id/entry2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:password="true" />
    </TableRow>     
</TableLayout>
  • 写回答

2条回答 默认 最新

  • myq_26 2012-10-15 02:03
    关注

    希望这个方法能帮上你:

    <TableLayout android:id="@+id/table" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:stretchColumns="1"
        android:layout_below="@+id/banner">
        <TableRow>
            <TextView android:id="@+id/username_label"
                android:layout_width="wrap_content"     android:layout_height="wrap_content"
                android:textColor="#fff" android:textSize="18dip" android:text="Username" />
            <EditText android:id="@+id/entry1" android:layout_width="fill_parent"
                android:layout_height="wrap_content" />
        </TableRow>
    
        <TableRow>
            <TextView android:id="@+id/password_label"
                android:layout_width="fill_parent" android:layout_height="wrap_content"
                android:textColor="#fff" android:textSize="18dip" android:text="Password" />
            <EditText android:id="@+id/entry2" android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:password="true" />
        </TableRow>
    </TableLayout>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用