android ScrollView--Linearlayout可以上下拖动
16lz
2022-06-17
动态添加:
[java] view plain copy
[java] view plain copy
- <?xmlversion="1.0"encoding="utf-8"?>
- <ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:scrollbars="vertical"
- android:fadingEdge="vertical">
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical"
- >
- </LinearLayout>
- </ScrollView>
动态代码上:
scrollView=new ScrollView(getApplicationContext());
scrollView.setBackgroundColor(getResources().getColor(android.R.color.holo_blue_dark));
scrollView.setScrollbarFadingEnabled(true);
scrollview.addView(XXXX);
值得一提的是XXX只能是一个总的控件或者一个子控件,如果直接添加两个子控件会报错。
更多相关文章
- android Textview颜色渐变
- Android:横行滚动且隔行变色的ListView控件
- Android(安卓)TextView 给文本中指定片段添加自定义点击事件
- Android(安卓)M 去除抽屉模式
- Android在程序中动态生成控件,动态布局
- [Android(安卓)Pro] Notification的使用
- android添加各种权限整理
- Android(安卓)Fragment页打开相册
- Android(安卓)实现图片的放大缩小及左右滑动(说明书效果)