安卓模拟器Android SDK安装完整图文教程,在最新的Adroid4.0.3R2模拟器中,已经加入了GPU支持,可以支持OeGLES2.0标准,让开发者可以借助模拟器来测试自己的OeGL游戏。在去......
Android如何使用scroll view组件
Android如何使用scroll view组件
工具/原料
- android studio
方法/步骤
首先打开android main xml布局文件
找到scroll view 并且添加到视图
main的布局文件代码关键部分:
ScrollView android:id="@ id/scrollView" android:layout_width="match_parent" android:layout_height="wrap_content" android:fadeScrollbars="false">TextView android:id="@ id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toTopOf="parent" />/ScrollView>
然后在strings.xml设置文本内容
回到main activity中,在其Java代码中加入如图的代码:
主要是先findviewbyid,然后直接对textview操作即可。
oncreate部分
:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView=findViewById(R.id.textView1); contents=new StringBuilder(); for(int i=0;i=1000;i ) contents.append(R.string.content); textView.setText(contents);}
当然我们也是可以通过Android如何使用scroll view组件来设置侧边的滚动条的状态。
最后的实现效果
以上方法由办公区教程网编辑摘抄自百度经验可供大家参考!
标签: Android
相关文章
- 详细阅读
- 详细阅读
-
Delphi XE7下如何创建一个Android模拟器调试详细阅读
Delphi XE7下如何创建一个Android模拟器调试,利用DelhiXE7我们可以进行多种设备程序的开发,尤其是移动开发应用程序得到不断地加强。在实际的Adroid移动程序开发中,如果我们直接用......
2023-03-17 407 Android