当地按钮只是multilline TextView中的TextView结束之后? [英] Place Button just after end of TextView in multilline TextView?

查看:161
本文介绍了当地按钮只是multilline TextView中的TextView结束之后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了包含一些文本视图和按钮的Andr​​oid应用程序。

我需要把按钮只是文本视图之后。当我的TextView的是,成效良好的单行。但是,使用文本视图的多行的时候,我的按钮被放置在1号线的终点。

如何放置按钮,在正确的位置(在文本视图中最后一行之后)?

在编辑:结果
这是我的XML,我用它在我的code和动态地生成它。

 < TableLayout
   的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
  机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:paddingTop =10dp
机器人:shrinkColumns =1
机器人:stretchColumns =1>   <的TableRow机器人:ID =@ + ID / tableRow1>
 <按钮
    机器人:ID =@ + ID / ayehPlace_btnCounter
    风格=机器人:ATTR / buttonStyleSmall
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT
    机器人:背景=@绘制/ ayeh_counter
    机器人:文字=/>
<的TextView
    机器人:ID =@ + ID / ayehPlace_txtAyeh
    机器人:layout_width =WRAP_CONTENT
    风格=@风格/ ayehPlace_txt
    机器人:layout_height =WRAP_CONTENT
    机器人:文字=/>
< /&的TableRow GT;
< / TableLayout>


解决方案

我想,你需要与Android一起使用TableLayout:重力=底。试试吧。

I'm developing an Android application that contains some text view and button.

I need to put Button just after the text view. When my TextView is single line that's working well. But when using multiple line of text view , my button was placed to the end of line 1.

How to place button in the right position (after last line in the text view)?

after edit :
this is my xml , I use it in my code and generate it dynamically .

<TableLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:shrinkColumns="1"
android:stretchColumns="1"  >

   <TableRow android:id="@+id/tableRow1" >
 <Button
    android:id="@+id/ayehPlace_btnCounter"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/ayeh_counter"
    android:text="" />
<TextView
    android:id="@+id/ayehPlace_txtAyeh"
    android:layout_width="wrap_content"
    style="@style/ayehPlace_txt"
    android:layout_height="wrap_content"
    android:text="" /> 
</TableRow>
</TableLayout>

解决方案

I think, you need to use TableLayout together with android:gravity="bottom". Try it.

这篇关于当地按钮只是multilline TextView中的TextView结束之后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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