没有合适的资源?快使用搜索试试~ 我知道了~
android界面开发源码大集合
需积分: 10 12 下载量 103 浏览量
2012-12-15
12:04:13
上传
评论 5
收藏 300KB PDF 举报
温馨提示
试读
22页
android界面开发源码大集合 里面包含各种各样的安卓控件的使用,源码说明等等, 非常适合开发者的参考
资源推荐
资源详情
资源评论
第 1 页 共 22 页
常用系统控件界面大合集
今天我用自己写的一个 Demo 和大家详细介绍一个 Android开发中遇到的一些常用系统控件
的使用技巧。
1.文本框 TextView
TextView 的作用是用来显示一个文本框,下面我用两种方式为大家呈现 TextView,
第一种是通过 xml 布局文件呈现 ,第二种是通过代码来呈现,由此可见 Android 的界面非
第 2 页 共 22 页
常灵活。
1. public class TextViewActivity extends Activity {
2. @Override
3. protected void onCreate(Bundle savedInstanceState) {
4. setContentView(R.layout.textview);
5.
6. LinearLayout ll = (LinearLayout)
findViewById(R.id.textviewll);
7. TextView textView = new TextView(this);
8. //设置显示文字
9. textView.setText("从代码中添加一个 TextView");
10. //设置显示颜色
11. textView.setTextColor(Color.WHITE);
12. //设置显示字体大小
13. textView.setTextSize(18);
14. //设置显示背景颜色
15. textView.setBackgroundColor(Color.BLUE);
16. //设置锚点位置
17. textView.setGravity(Gravity.CENTER_VERTICAL|Gravity.CENTER_
HORIZONTAL);
第 3 页 共 22 页
18. //把这个 view 加入到布局当中
19. ll.addView(textView);
20.
21. super.onCreate(savedInstanceState);
22. }
23. }
复制代码
1. <?xml version="1.0" encoding="utf-8"?>
2. <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
3. android:id="@+id/textviewll"
4. android:orientation="vertical"
android:layout_width="fill_parent"
5. android:layout_height="fill_parent">
6. <TextView android:id="@+id/textView0"
7. android:layout_width="fill_parent"
8. android:layout_height="wrap_content"
9. android:textColor="#000000"
10. android:textSize="18dip"
11. android:background="#00FF00"
12. android:text="@string/textView"
13. android:gravity="center_vertical|center_horiz
ontal"
14. />
15. </LinearLayout>
复制代码
2.网页框 WebView
WebView 可以实现 类似 web 的网页 的系统控件 最主要的是可以使用 html 代码,如访问
第 4 页 共 22 页
网页等。
第 5 页 共 22 页
1. public class WebViewActivity extends Activity {
2. WebView webView = null;
3. static final String MIME_TYPE = "text/html";
4. static final String ENCODING = "utf-8";
5.
6.
7. @Override
8. protected void onCreate(Bundle savedInstanceState) {
9. setContentView(R.layout.webview);
10.
11. webView = (WebView) findViewById(R.id.webview);
12. webView.loadDataWithBaseURL(null,"<a
href='http://blog.csdn.net/xys289187120'>欢迎访问雨松 MOMO 的博客
</a>", MIME_TYPE, ENCODING, null);
13. super.onCreate(savedInstanceState);
14. }
15. }
复制代码
剩余21页未读,继续阅读
资源评论
riverjjj
- 粉丝: 5
- 资源: 25
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第一百十五阶段 - 4.4.2.113全局变量的作用域-113 -2024.04.26
- 2023-04-06-项目笔记 - 第一百十五阶段 - 4.4.2.113全局变量的作用域-113 -2024.04.26
- htmlzwbjq_downyi.com.zip
- 无头单向非循环链表的实现(Test.c)
- 无头单向非循环链表的实现(SList.c)
- 浏览器重定向插件更新文件
- SSA-BP麻雀算法优化BP神经网络多特征分类预测(Matlab实现完整源码和数据)
- 粒子群算法优化BP神经网络PSO-BP的MATLAB代码(数值预测)
- 基于Springboot的一起看书平台.zip
- 无头单向非循环链表的实现(SList.h)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功