如何更改布局的知名度programaticly

如何更改布局的知名度programaticly

本文介绍了如何更改布局的知名度programaticly的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

还有就是要改变视图的可见性的方式,但我怎么可以改变布局的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 的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 09:47