Android程式码怎么添加按钮,Android,UI 在程式中即時加上其他的UI?|?柯博文 Powen Ko...
Android,UI 在程式中即時加上其他的UI
0 Comments
柯博文 在下面介紹, 如何在Android UI 在程式中即時加上其他的UI
View tmpView;
tmpView = inflater.inflate(R.layout.login, null);
getWindow().addContentView(tmpView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
Button buttonView = new Button(this);
buttonView.setText("Button " );
getWindow().addContentView(buttonView,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT ViewGroup.LayoutParams.WRAP_CONTENT ));
// 按鈕
LayoutInflater inflater = getLayoutInflater();
View tmpView;
tmpView = inflater.inflate(R.layout.login, null);
getWindow().addContentView(tmpView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
Button buttonView = new Button(this);
buttonView.setText("Button " );
getWindow().addContentView(buttonView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT ));
//文字
TextView textView = new TextView(this);
textView.setText("Text View " );
@SuppressWarnings("deprecation")
AbsoluteLayout.LayoutParams abs_params =
new AbsoluteLayout.LayoutParams(
//width in pixels
100,
//height in pixels
100, 100, 100
);
getWindow().addContentView(textView,abs_params);
AbsoluteLayout as = new AbsoluteLayout(this);
TextView tvTop = new TextView(this);
tvTop.setText("top");
tvTop.setLayoutParams(new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.FILL_PARENT, AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 0));
TextView tvMid = new TextView(this);
tvMid.setText("middle");
tvMid.setLayoutParams(new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.FILL_PARENT, AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 80));
TextView tvright = new TextView(this);
tvright.setText("right");
tvright.setLayoutParams(new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.FILL_PARENT, AbsoluteLayout.LayoutParams.WRAP_CONTENT, 200, 80));
TextView tvBot = new TextView(this);
tvBot.setText("bottom");
tvBot.setLayoutParams(new AbsoluteLayout.LayoutParams(AbsoluteLayout.LayoutParams.FILL_PARENT, AbsoluteLayout.LayoutParams.WRAP_CONTENT, 0, 180));
as.addView(tvTop);
as.addView(tvMid);
as.addView(tvright);
as.addView(tvBot);
getWindow().addContentView(as,new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT ));
Android程式码怎么添加按钮,Android,UI 在程式中即時加上其他的UI?|?柯博文 Powen Ko...相关推荐
- android 自定义关机界面,android源码探索之定制android关机界面的方法
本文实例讲述了android源码探索之定制android关机界面的方法.分享给大家供大家参考.具体如下: 在Android系统中,长按Power键默认会弹出对话框让你选择"飞行模式" ...
- android studio怎么添加按钮,Android Studio 工具栏添加常用按钮
本文中 Android Studio 的版本为 android Studio 2.2 ,操作系统为 Windows,如有操作不同,可能是版本差异. 在工具栏中添加一些常用的按钮,如设置.DDMS,有利 ...
- mac下调试android源码,MacBooK pro调试Android 8.1源码
工具的选择 1.Android Studio(能够看,能够调试) 2.understand (只适合看)html macbook pro基本上只有这两款能够选择,刚开始用了understand发现并不 ...
- android源码编译jar,在android源码编译中导入第三方jar包
源码编译,我们可以只留下app的src,res目录和androidmanifest.xml文件,在app的根目录添加一个android.mk文件,还有我们需要导入的jar包,我这里是libjsoup- ...
- WSL Ubuntu 20.04下Android源码编译与导入Android Studio
源码下载见前文:WSL Ubuntu 20.04下Android源码下载 idegen 模块编译 在development/tools/idegen/README下可以看到关于 idegen 工具的相 ...
- android源码模块编译错误,Android 源码编译错误记录
构建环境 mac os 10.14.5 在构建过程中报如下错误: Could not find a supported mac sdk: ["10.10" "10.11& ...
- android源码编译 简书,android学习笔记之源码编译
编译环境 1.需要Ubuntu 64bit,建议Ubuntu14.04 64-bit 2.安装openJDK7 $ sudo apt-get update $ sudo apt-get install ...
- android 在指定位置添加布局,Android 如何动态添加 View 并显示在指定位置。
引子 最近,在做产品的需求的时候,遇到 PM 要求在某个按钮上添加一个新手引导动画,引导用户去点击.作为 RD,我哗啦啦的就写好相关逻辑了.自测完成后,提测,PM Review 效果. 看完后,PM ...
- lottie android 源码,Lottie动画库 Android 端源码浅析
惊艳的Lottie 前段时间airbnb开源的动画库Lottie得到了不错的反响,旨在解决Android.IOS.RN 上面开发动画成本高.表现不一致的问题,可以说降低了三端动画的开发成本. 先上几个 ...
最新文章
- 过滤当前主机的IPV4地址
- DL之AF:机器学习/深度学习中常用的激活函数(sigmoid、softmax等)简介、应用、计算图实现、代码实现详细攻略
- mfc创建一个word操作工程 【转自:http://blog.csdn.net/tg2003/article/details/4399981】
- JSR 303 - Bean Validation 简介及使用方法
- 死于非命的中国亿万富翁们 1
- 解决asp.net 3.5sp1错误
- 曝李国庆抢走当当公章发《告当当全体员工书》,当当网:已报警,公章作废...
- vs2005菜单:工具-选项-环境
- 2017年 Java 程序员,风光背后的危机
- 如何将Sublime Text中的代码以彩色高亮形式复制到博客或word文档里
- 什么是产品的愿景—从一篇博文中学得到
- 神器!程序员必备的Linux命令行大全(PDF下载)
- NSSM通俗易懂介绍,安装与使用
- 用matlab如何求导,matlab如何求导 matlab求导 matlab如何求导
- VB SendMessage 函数
- 如何看apk支持的最低Android版本,目标Android版本?
- 老男孩数据库学习记录
- python中seed的相关代码
- 【微信小程序】微信小程序如何使用自定义的图标--学习微信小程序之路05
- 【php】empty()详解
热门文章
- 第二证券|北上资金连续六周净流入,持续看好大消费板块
- 雷神之锤隐藏技能—穿云箭
- N1盒子通过openwrt的docker安装cups让古董usb打印机实现无线打印和扫描
- java计算机毕业设计沙县小吃点餐系统源程序+mysql+系统+lw文档+远程调试
- 第三章 multidimensional scaling
- Android下载网络图片并保存到相册
- 手机访问本地开发网页
- SCARA机器人运动学模型建立
- 软件设计师——标准化和知识产权
- 量化投资学习——Dealing with the Inventory Risk A solution to the market making problem