滚动型的能见度 [英] Visibility of ScrollView

查看:143
本文介绍了滚动型的能见度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用两个ScrollViews并要设置一个可视性GONE或不可见的,但是当我用C应用程序终止以下Java $ C $做到这一点。如果我使用属性平底锅做同样的事情,在日食,它只是工作。什么是错的?

I am using two ScrollViews and want to set visibility of one as GONE or INVISIBLE but when I do it by following java code the application terminates. If I do the same thing using Properties pan, in the eclipse, it just works. What is wrong?

公共类测试扩展活动{

List<ScrollView> sv;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    sv = new ArrayList<ScrollView>();

    sv.add((ScrollView)findViewById(R.id.scrollView1));
    sv.add((ScrollView)findViewById(R.id.scrollView2));

    sv.get(1).setVisibility(View.GONE);

    setContentView(R.layout.main);
}

}

    
        
            
        
    
    
        
    

推荐答案

你首先要设置布局文件。

First of you have to set layout file.

setContentView(R.layout.new_view);
sv = new ArrayList<ScrollView>();

sv.add((ScrollView)findViewById(R.id.scrollView1));
sv.add((ScrollView)findViewById(R.id.scrollView2));

sv.get(1).setVisibility(View.GONE);

试试这个,如果你得到任何错误,那么请张贴logcat的。

try this if you are getting any error then please post logcat.

这篇关于滚动型的能见度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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