zoukankan      html  css  js  c++  java
  • android ScrollView--Linearlayout可以上下拖动

    动态添加:
    [java] view plaincopy
    1. <?xml version="1.0" encoding="utf-8"?>    
    2. <ScrollView    
    3.     xmlns:android="http://schemas.android.com/apk/res/android"    
    4.     android:layout_width="fill_parent"    
    5.     android:layout_height="fill_parent"    
    6.     android:scrollbars="vertical"    
    7.     android:fadingEdge="vertical">    
    8.     <LinearLayout    
    9.         android:layout_width="fill_parent"    
    10.         android:layout_height="fill_parent"    
    11.         android:orientation="vertical"    
    12.         >    
    13.     </LinearLayout>    
    14. </ScrollView>    



    动态代码上:

    scrollView=new ScrollView(getApplicationContext());
    scrollView.setBackgroundColor(getResources().getColor(android.R.color.holo_blue_dark));
    scrollView.setScrollbarFadingEnabled(true);

    scrollview.addView(XXXX);

    值得一提的是XXX只能是一个总的控件或者一个子控件,如果直接添加两个子控件会报错。

  • 相关阅读:
    8.使用axios实现登录功能
    7.django配置跨域并开发测试接口
    9.Vue组件
    2.初始化项目结构
    1.Django基础
    团队冲刺——第七天
    团队冲刺——第六天
    十天冲刺——第五天
    十天冲刺——第四天
    十天冲刺——第三天
  • 原文地址:https://www.cnblogs.com/new0801/p/6175818.html
Copyright © 2011-2022 走看看