Android UI 设计——Button 控件

论坛 期权论坛     
选择匿名的用户   2021-6-2 16:49   404   0
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> 这个是大家在熟悉不过的了,初学者在学习的时候都是最先使用Button进行练习。</p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> <br style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important"> </p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> 他控件的显示设置也很简单,如TextView一样包括:id,宽,高,名称(也就是显示的文字)等的设置。在此不再赘述。</p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> <br style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important"> </p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> <span style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important"><span style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important; color:rgb(192,0,0)">点击事件</span></span></p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> <br style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important"> </p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> Button 最常见的一种使用就是使用监听器,实现点击事件。首先在Activity的onCreate方法中添加如下代码:</p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> <br style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important"> </p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> 方式一:通过匿名内部类的方法来实现监听。</p>
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important"> <br style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important"> </p>
<blockquote style="margin:0px; padding:0px 0px 0px 10px; max-width:100%; border-left-width:3px; border-left-style:solid; border-left-color:rgb(219,219,219); color:rgb(62,62,62); font-family:&#39;Helvetica Neue&#39;,Helvetica,&#39;Hiragino Sans GB&#39;,&#39;Microsoft YaHei&#39;,Arial,sans-serif; font-size:16px; line-height:25.6000003814697px; word-wrap:break-word!important">
<p style="margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; max-width:100%; clear:both; min-height:1em; white-space:pre-wrap; word-wrap:break-word!important"> <span style="margin:0px; padding:0px; max-width:100%; word-wrap:break-word!important; font-size:12px"><span class="crayon-h" s
分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP