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 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题