Android ApiDemos示例解析(152):Views->Layouts->RelativeLayout->2.Simple Form

Simple-Login-Form:这是一个简单的登录表格,可以练习我的技能 立即下载

本例和前面LinearLayout 的示例Android ApiDemos示例解析(145):Views->Layouts->LinearLayout->5.Simple Form 实现同样的功能构造一个输入表单,但本例使用的是RelativeLayout布局。 实际开发时可以自行决定使用哪种布局。

<RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:background=”@drawable/blue”
android:padding=”10dip”>

<!–
TextView goes at the top left by default .
–>
<TextView
android:id=”@+id/label”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:text=”@string/relative_layout_2_instructions”/>

<!–
Put the EditText field under the TextView
Also give it a standard background (the “android:”
part in @android:drawable/editbox_background
means it is system resource rather than
an application resource.
–>
<EditText
android:id=”@+id/entry”
android:layout_width=”match_parent”
android:layout_height=”wrap_content”
android:background=”@android:drawable/editbox_background”
android:layout_below=”@id/label”/>

<!–
The OK button goes below the EditText field.
It is also aligned to the right edge of the parent
(respecting the parent’s padding).
The OK button comes first so the Cancel button
can be specified relative to the OK button.
–>
<Button
android:id=”@+id/ok”
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_below=”@id/entry”
android:layout_alignParentRight=”true”

android:layout_marginLeft=”10dip”
android:text=”@string/relative_layout_2_ok” />

<!–
The Cancel button is aligned with the top of
the OK button and positioned to the left of it.
Since the OK button has a left margin of 10, there
is some space between the two buttons.
–>
<Button
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:layout_toLeftOf=”@id/ok”
android:layout_alignTop=”@id/ok”

android:text=”@string/relative_layout_2_cancel” />

</RelativeLayout>

RelativeLayout 支持的布局属性有如下几种:

  • layout_above: 将本View的底边放在指定的view的上面。
  • layout_alignBaseline: 将本View的baseline和指定的View的Baseline对齐。
  • layout_alignBottom: 将本View的底边和指定的View底部对齐。
  • layout_alignLeft: 将本View和指定View左边对齐。
  • layout_alignParentBottom: 将本View和父容器底部对齐。
  • Layout_alignParentLeft:将本View和父容器左边对齐。
  • layout_alignParentRight: 将本View和父容器右边对齐。
  • Layout_alignParentTop:将本View和父容器顶部对齐。
  • layout_alignRight: 将本View和指定View右边对齐。
  • layout_alignTop: 将本View和指定View顶部对齐。
  • layout_alignWithParentIfMissing: 为True时,如果View指定的toLeftOf 或toRightOf 找不到时,使用父容器作为替代物。
  • layout_below: 将本View放在指定View的下面。
  • layout_centerHorzontal: 为true时,将此View在父容器中水平居中。
  • layout_centerInParent: 为true时,将此View在父容器中水平和垂直都居中。
  • layout_centerVertical: 为true时,将此View在父容器中垂直居中。
  • layout_toLeftOf: 将此View放在指定View的左边
  • layout_toRightOf: 将此View放在指定View的右边。

 
无耳科技 Solon v3.0.8 发布,Java 企业级应用开发框架 Solon 是新一代,Java 企业级应用开发框架。是杭州无耳科技有限公司的“根级”开源项目(最近“杭州六小龙”很火啊,我们也是杭州的哦)。从零开始构建(No Spring、No Java-EE、No Servlet),有灵活的接口规范与开放生态。采用对商用友好的 Apache 2.0 开源协议。 阅读详情

相关推荐

gesp c++ 八级知识点

gesp c++ 八级知识点

MMD.然大大 2252

python中str内置函数isdigit、isdecimal、isnumeric的区别

isdecimal(...) | S.isdecimal() -> bool | | Return True if there are only decimal characters in S, | False otherwise. 翻译:如果S中只有十进制字符,则返回True,否则为False。 isdigit(...) |...

weixin_34267123的博客 548

Oracle19c SYSAUX表空间爆满?手把手教你清理SM/ADVISOR和AUDSYS占用(附完整SQL)

本文详细解析了Oracle19c中SYSAUX表空间爆满的常见原因及解决方案,重点针对SM/ADVISOR和AUDSYS组件的空间占用问题提供了完整的SQL清理脚本。通过诊断查询、空间清理和预防性维护策略,帮助DBA有效管理SYSAUX表空间,确保数据库稳定运行。

weixin_28338005的博客 243

关于Android中layout_centerHorizontal、layout_gravity、gravity的区别

layout_centerHorizontal 1、是RelativeLayout(相对布局)的属性 2、若设置为“true”,就将该控件设置在相对于父控件水平居中的位置         android:layout_centerHorizontal="true"    layout_gravity 1、LinearLayout的一种控件对齐方式,可以把值设置成下列值: cent...

我本浪人--游吟世间 1万+

关于StartAI本地部署相关问题解答

很多小伙伴们都有接入自己本地SD的需求,对此小编整理了一些相关问题~

HDJ9387的博客 941

深入解析HAL_UART_Receive_IT:如何高效配置串口中断接收

本文深入解析了STM32 HAL库中`HAL_UART_Receive_IT`函数的工作原理与高效配置方法。该函数并非直接接收数据,而是作为中断接收的启动器和配置器,通过开启相关中断,由`UART_Receive_IT`在后台完成数据搬运。文章详细对比了中断与轮询模式的区别,并提供了不定长数据接收的完整实战流程、常见问题避坑指南及高级应用技巧,帮助开发者构建稳定高效的串口通信。

weixin_29162439的博客 648

Android ApiDemos示例解析(165):Views->Layouts->TableLayout->10. Simple Form

前面介绍了使用LinerLayout和RelativeLayout构造Simple Form: Android ApiDemos示例解析(145):Views-&gt;Layouts-&gt;LinearLayout-&gt;5.Simple Form Android ApiDemos示例解析(152):Views-&gt;Layouts-&gt;RelativeLayou...

mapdigit 231

LabVIEW调用.so文件的方法

LabVIEW调用.so文件的方法

m0_37878912的博客 3025

SimpleDateFormat(示例,出错代码)

转自:http://www.apihome.cn/api/java/SimpleDateFormat.html ava.text 类 SimpleDateFormat java.lang.Object java.text.Format java.text.DateFormat java.text.SimpleDateFormat 所有已

chengly0129的专栏 1311

【干货】SAP物料分类账的简单理解

一、SAP物料分类账理解 物料分类账,简称ML(material ledger),其基本用途是可以用八个字概括“还原成本”、“还原库存”。即通过月底运行物料分类账,将库存差异(原材料-材料成本差异、库存商品-自制半成本差异、库存商品-自制产成品差异)自动按当期库存出库数和库存结存数的比例分摊至成本和库存中。为了理解其概念,可以简单举一个例子: 开一工单,生产A产品,数量为3个,当月全部生产完工

ERP运维咨询(目标和成功) 1万+

EtherCAT ROS2 入门教程(一)

本文介绍了EtherCAT驱动与ROS2的集成方案,主要包括三部分内容:1)在Ubuntu 22.04上安装IgH EtherCAT主站的详细步骤,包括内核配置、源码编译和网络适配器设置;2)构建ethercat_driver_ros2,通过ros2_control描述文件配置硬件接口和EtherCAT从站模块插件;3)使用方法,包括启动EtherCAT主站和运行配置包。该方案支持通过参数文件定义硬件接口,并提供通用和专用两种EtherCAT模块插件,便于开发基于EtherCAT的工业应用。

机器人控制与仿真应用 1531

java 日期格式化类SimpleDateFormat的使用:日期转字符,字符转日期

java 日期格式化类SimpleDateFormat的使用:日期转字符,字符转日期1. java.text.SimpleDateFormat类 博客背景,本人是名java实习生,在实习阶段遇到了遇到了业务需求非常奇葩的医疗软件,其对时间格式的要求非常的奇葩,所以写这篇博客以总结和记录 SimpleDateFormat类日期格式转换的用法。 1. java.text.SimpleDateForma...

码农回顾 977

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

SimpleDateFormat 源码解析

今天一个朋友突然说起了字符串解析的时候,如果字符串超出的时候  时间会出现变动的情况 我觉得这个问题很有意思  就开始查看源码,这篇博客的主题内容将围绕这个展开,接下来讲干货。 当我们在解析时间的时候 往往会采用下面的格式 import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.

月光轩辕的专栏 3595

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

SimpleDateFormat使用详解

public class SimpleDateFormat extends DateFormat SimpleDateFormat 是一个以国别敏感的方式格式化和分析数据的具体类。 它允许格式化 (date -> text)、语法分析 (text -> date)和标准化。 SimpleDateFormat 允许以为日期-时间格式化选择任何用户指定的方式启动。 但是,希望用 DateFor

2731

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

SimpleDateFormat 源码分析

日期类转换在工作中是比较常用的。写法如下:SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date date = new Date(); String s = simpleDateFormat.format(date);运行即可得出当前日期字符串。 下面

Android_小菜菜的博客 2408

在rails 中,使用 simple_form 和 bootstrap 3.0 组件来美化radio button

'btn btn-primary'){ b.radio_button + b.text } %> 产生的html 代码是 : 特区内 特区外 其中注意的几个要点: 1.  data-togg

一个烂人的随手笔记 4231

JAVA中的日期格式化

<br /> <br />方法一:自己格式化~<br />java.util.Date date = new java.util.Date();<br />int year = date.getYear();<br />int mounth = date.getMounth+1<br />int day = date.getDay();<br />System.out.println(“日期:”+year+"/"+mounth+"/"+day);<br /> <br /> <br />方法二:java.te

tangwing的专栏 2674

SimpleDateFormat类

SimpleDateFormat类的作用是设置好某种格式: SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 将字符串转换为日期: Date dt = sdf.parse("2007-04-30"); 改变为中文日期格式: sdf.applyPattern("yyyy年MM月dd日"); 将日期转换为字符串: String str...

shaoxiongwang的专栏 181

Android Visualizer 实战:把声音画出来

是系统提供的音频效果(AudioEffect)之一。它挂在音频链路上,,把数据回吐给你——画波形、画频谱、做响度表。

Android的专栏 323

PHP多维数组排序完全指南

需求:订单按「待付款 → 待发货 → 已完成 → 已取消」排,而不是按字典序。??});用??给未知状态兜底,避免警告。/*** 多字段排序(usort 版,支持保留键名与自定义比较器)* 用法:* @param array $list 待排序数组* @param array $rules [字段名, 方向 asc|desc, 类型 numeric|string|natural|regular]* @param bool $keepKeys 是否保留键名(true 用 uasort)

qq_19716091的博客 234

Android 开发入门实践(十三):用 Intent、UiState 和 Reducer 理解 MVI 的状态更新

本文记录第141—145课对MVI架构的入门实践,通过“返回列表”功能逐步构建意图(NewsIntent)、状态(NewsUiState)与状态转换(reduce)机制。基于单向数据流,用户操作生成意图,ViewModel通过Reducer根据旧状态计算新状态,并通过StateFlow更新Compose界面。代码实现清晰分离关注点,强化了对状态管理、事件驱动与数据流的理解。

Easyhood的博客 359

RK-RK3572-Android16- 编译打包优化-OTA整包-差分包打包

这里主要记录一下 RK3572 在Android16 上面进行OTA升级的整包和差分包制作经验的一个分享,整理知识点,方便后续自己和其它同事开发提高工作效率、直接使用。不管哪一个平台,MTK 也好、RK也好 基本上都是不同Android版本各个子系统之间还是有一点点区别的,所以有必要记录整理知识点,方便提高开发效率、生产效率。针对OTA升级问题 ,再一次说明还是要看官方提供的文档,按照文档来。

十年饮冰,难凉热血 215

安卓APK下载后安装全流程:从点击下载到第一次启动,每一步的检查点

这套流程听起来繁琐,但真正需要每次都做的只有来源核对和签名校验两步,其他都是出问题时才查。养成习惯之后,能挡掉绝大多数"装了垃圾包""装完闪退"的情况。如果要省事,直接用这类会标注包名、版本号和校验信息的站点,比在搜索结果里挨个试要稳得多。

qq362196705的专栏 205

Android Laya 与 Native Bridge:页面识别、双向通信、协议设计和崩溃定位

Laya 与 Native 通信的难点不在于某个或的写法,而在于边界:页面来源是否可信、协议是否明确、线程是否正确、请求是否幂等、页面是否仍然存在、日志是否能关联一次完整请求。建立这些边界后,才能把“页面白屏”“按钮无响应”“重复消息”和“Native 崩溃”拆成可验证的层次,并沿着真实调用链找到根因。

路在脚下,幸福在手中,莫贪!!!!! 168
上一篇: 汉字编码问题
下一篇: Android ApiDemos示例解析(153):Views->Layouts->ScrollView->1.Short
引路蜂
博客等级 码龄16年 3122粉丝 711原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值