textview控件显示位置的设定

gqybb6666 2010-11-16 03:47:07
想动态的改变textview控件的显示位置

找了好久找到了如下接口
TextView.layout(l, t, r, b) 方发

但是更改后并没有效果(更改后使用了invalidate()方法和postInvalidate()方法,但是依然没有效果)

请大家帮忙看看,谢谢
...全文
540 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lenomonxiao 2012-04-20
  • 打赏
  • 举报
回复
项目中使用到的,无下划线效果。Android使用TextView实现无下划线超链接
saint_bxg 2010-11-18
  • 打赏
  • 举报
回复
可以用new 一个 AbsoluteLayout.LayoutParams设定位置和大小,然后再用 setLayoutParams函数来设定
http://blog.csdn.net/saint_bxg/archive/2010/05/19/5607903.aspx
gqybb6666 2010-11-17
  • 打赏
  • 举报
回复
怎么没人帮忙呀
gqybb6666 2010-11-16
  • 打赏
  • 举报
回复
试过了,还是不行,原码如下,请在帮忙看看,谢谢
Xml:
<FrameLayout android:id="@+id/page_positionl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="200px"
android:background="@color/black"
>
<TextView android:id="@+id/page_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:text="chapter_name"
android:textSize="@dimen/port_bookreader_toptar_fontsize"
>
</TextView>
</FrameLayout>

.java
mPagePosition = (TextView)findViewById(R.id.page_position);
page_positionl =(FrameLayout)findViewById(R.id.page_positionl);
mPagePosition.layout(mPagePosition.getLeft() + 100,mPagePosition.getTop(), mPagePosition.getWidth(),mPagePosition.getHeight());
mPagePositionl.invalidate();
dinjay 2010-11-16
  • 打赏
  • 举报
回复
你要对textview所在的parentview进行invalidate

80,490

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧