找到一个布局请求的原因在一个ViewGroup [英] Finding the cause of a layout request in a ViewGroup

查看:119
本文介绍了找到一个布局请求的原因在一个ViewGroup的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含在每个页面一RelativeLayout的一个发射状的侧面滚动定制的ViewGroup。在这个RelativeLayout的我有日志时onMeasure()被调用一些其他的看法。
当我翻到另一页,onMeasure被称为为每个视图六次。我已经消除了一些TextViews,因为他们要求布局通行证文本发生变化时,但我找不到其他原因进行布局的要求。

I have a Launcher-like side-scrolling custom ViewGroup that contains a RelativeLayout in each "page". Within this RelativeLayout I have some other views that log when onMeasure() is called. When I flip to another page, onMeasure is called six times for each view. I have already eliminated some TextViews because they request layout passes when the text changes, but I cannot find the other causes for layout requests.

有谁知道一个把戏找原因了内部的ViewGroup布局的要求?

Does anybody know a trick to find cause for layout requests within a ViewGroup?

在一个相关的说明,没有任何人知道一个把戏,以确保TextViews不要哭布局要求的文本变更时?还有埋在源的一些提示(<一个href=\"http://$c$csearch.google.com/$c$csearch/p?hl=en#uX1GffpyOZk/core/java/android/widget/TextView.java&q=package%3aandroid.git.kernel.org%20file%3aandroid/widget/TextView.java&sa=N&cd=1&ct=rc\" rel=\"nofollow\">http://$c$csearch.google.com/$c$csearch/p?hl=en#uX1GffpyOZk/core/java/android/widget/TextView.java&q=package:android.git.kernel.org%20file:android/widget/TextView.java&sa=N&cd=1&ct=rc左右线5500),但我不能做到这一点。

On a related note, does anybody know a trick to make sure that TextViews do not cry for layout requests when the text changes? There are some hints buried in the sources (http://codesearch.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/widget/TextView.java&q=package:android.git.kernel.org%20file:android/widget/TextView.java&sa=N&cd=1&ct=rc around line 5500), but I couldn't make it happen.

谢谢!

推荐答案

TextView中需要一个布局传递时,该文本的变化,你不能真正解决这个问题。

TextView needs a layout pass when the text changes, you can't really work around this.

这篇关于找到一个布局请求的原因在一个ViewGroup的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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