android制作一个类似ms office文本框的文本视图

android制作一个类似ms office文本框的文本视图,android,textbox,textview,Android,Textbox,Textview,我有一个新问题 该项目需要一个以位图(我已将其制作成9个补丁)为背景的textview,但用户可以通过手势调整其宽度和高度,就像ms office中的文本框一样,用户可以使用鼠标重新调整文本框,其中的文本将重新发布 这是我的密码: 1.这是为了标记下来保存textview的属性。publicET是一个文本视图 ts.setPositionX(publicET.getLeft()); ts.setPositionY(publicET.

我有一个新问题

该项目需要一个以位图(我已将其制作成9个补丁)为背景的textview,但用户可以通过手势调整其宽度和高度,就像ms office中的文本框一样,用户可以使用鼠标重新调整文本框,其中的文本将重新发布

这是我的密码: 1.这是为了标记下来保存textview的属性。publicET是一个文本视图

                ts.setPositionX(publicET.getLeft());
                ts.setPositionY(publicET.getTop());
                ts.setLength(publicET.getBottom());
                ts.setWidth(publicET.getRight());
2.然后我显示这个textview,我设置textview的这个属性:

                TextObject tObj = new TextObject();
                tObj.setId(Integer.parseInt(String.valueOf(id)));
                tObj.setPageId(getPageNum);
                tObj.setAlbumId(albumId);
                tObj.setContent(publicET.getText().toString());
                tObj.setPositionX(textPositionX);
                tObj.setPositionY(textPositionY);
                tObj.setLength(textPositionB);
                tObj.setWidth(textPositionR);
                tObj.setColor(curPicBackColor);
                tObj.setSize(curTextFontSize);
                tObj.setTextFont(typefacestr);
                publicET.setTag(tObj);
                publicET.setBackgroundDrawable(null);
TestObject类如下所示:

public class TextObject {

private Integer id;
private Integer pageId;
private Integer albumId;
private String content;
private Integer positionX;
private Integer positionY;
private Integer length;
private Integer width;
private String color;
private Integer size;
private String textFont;

public Integer getId() {
    return id;
}
public void setId(Integer id) {
    this.id = id;
}
public Integer getPageId() {
    return pageId;
}
public void setPageId(Integer pageId) {
    this.pageId = pageId;
}
public Integer getAlbumId() {
    return albumId;
}
public void setAlbumId(Integer albumId) {
    this.albumId = albumId;
}
public String getContent() {
    return content;
}
public void setContent(String content) {
    this.content = content;
}
public Integer getPositionX() {
    return positionX;
}
public void setPositionX(Integer positionX) {
    this.positionX = positionX;
}
public Integer getPositionY() {
    return positionY;
}
public void setPositionY(Integer positionY) {
    this.positionY = positionY;
}
public Integer getLength() {
    return length;
}
public void setLength(Integer length) {
    this.length = length;
}
public Integer getWidth() {
    return width;
}
public void setWidth(Integer width) {
    this.width = width;
}
public String getColor() {
    return color;
}
public void setColor(String color) {
    this.color = color;
}
public Integer getSize() {
    return size;
}
public void setSize(Integer size) {
    this.size = size;
}
public String getTextFont() {
    return textFont;
}
public void setTextFont(String textFont) {
    this.textFont = textFont;
}
}

我无法控制此textView的属性显示在正确的位置。我通过日志检查了位置是否正确。
期待着你的帮助。谢谢。

这是我的代码,它可以工作:

RelativeLayout.LayoutParams paramst = new RelativeLayout.LayoutParams(
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT,
                android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
        paramst.setMargins(o.getPositionX(), o.getPositionY(),
                o.getWidth(), o.getLength());
        TextView e = new TextView(this);        
        e.setBackgroundResource(R.drawable.edittext_bg2);
        e.setLayoutParams(paramst);
        e.setWidth(o.getWidth()-o.getPositionX());

我现在找到了解决办法。我已经设置了textview的宽度,设置了布局参数,它也可以工作,就像textview一样。setWidth(intpx)请添加解决方案作为答案并接受,这样问题就结束了。我已经提出了它。