问题描述
还有就是要改变视图的可见性的方式,但我怎么可以改变布局的XML定义programaticly的知名度?如何获取布局对象?
<的LinearLayout
机器人:ID =@ + ID / contacts_type
机器人:方向=横向
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:能见度=水涨船高>
< / LinearLayout中>
看一看 View.setVisibility(View.GONE / View.VISIBLE / View.INVISIBLE)
从 API文档:
请注意,<$c$c>LinearLayout$c$c>是 的ViewGroup
而这又是一个 查看
。也就是说,你很可能调用,例如, myLinearLayout.setVisibility(View.VISIBLE)
。
这是有道理的。如果您有AWT / Swing的任何经验,你会从容器
和组件
之间的关系认识它。 (A 容器
的是的组件
)
There is the way to change visibility of View, but how can I change programaticly visibility of layout defined in XML? How to get layout object?
<LinearLayout
android:id="@+id/contacts_type"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone">
</LinearLayout>
Have a look at View.setVisibility(View.GONE / View.VISIBLE / View.INVISIBLE)
.
From the API docs:
Note that LinearLayout
is a ViewGroup
which in turn is a View
. That is, you may very well call, for instance, myLinearLayout.setVisibility(View.VISIBLE)
.
This makes sense. If you have any experience with AWT/Swing, you'll recognize it from the relation between Container
and Component
. (A Container
is a Component
.)
这篇关于如何更改布局的知名度programaticly的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!