最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Android编程实现将ButtonBar放在屏幕底部的方法
时间:2017-05-11 编辑:简简单单 来源:一聚教程网
前面一篇《Android编程实现将tab选项卡放在屏幕底部的方法》提到ButtonBar的方式写底部button,试了试,看起来外观貌似比Tab好看,不过恐怕没有Tab管理Activity方便吧,毕竟一 个Tab就是一个Activity,但是这样用Button的话,却并不如此,所以这样的涉及可能虽然好看点,但是管理起来却是相当麻烦。那么暂且把对 activity的管理放在一边,只看界面的设计吧。
要涉及这样的一个buttonbar,主要就是要用到style="@android:style/ButtonBar"这个风格。首先还是来看xml的设计,保存layout/bottombtn.xml
代码如下 | 复制代码 |
android:orientation="vertical"android:layout_width="fill_parent" android:layout_height="fill_parent"> android:layout_height="wrap_content"android:id="@+id/textOut" android:padding="5px"android:layout_weight="1"/> android:layout_width="fill_parent"android:layout_height="wrap_content" android:orientation="horizontal"> android:layout_width="0dip"android:layout_height="wrap_content" android:layout_weight="1"/> android:layout_width="0dip"android:layout_height="wrap_content" android:layout_weight="1"/> android:layout_width="0dip"android:layout_height="wrap_content" android:layout_weight="1"/> android:layout_width="0dip"android:layout_height="wrap_content" android:layout_weight="1"/> android:layout_width="0dip"android:layout_height="wrap_content" android:layout_weight="1"/> |
然后就是关于这个的全部代码了:
代码如下 | 复制代码 |
packagenet.wangliping.popup; importandroid.app.Activity; importandroid.os.Bundle; importandroid.widget.TextView; publicclassBottomBtnextendsActivity { privatestaticString LOG_TAG ="BottomBtn"; privateTextView tv; @Override publicvoidonCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.bottombtn); tv = (TextView)findViewById(R.id.textOut); tv.setText("http://tools.wangliping.net"); } } |
如此这般,就形成了下面的这个东西,虽然界面上看起来稍微美观一点,还是上面那句话:管理器Activity不一定很方便哦。
相关文章
- Android视频播放器屏幕左侧边随手指上下滑动亮度调节功能的原理实现 05-01
- Android中判断屏幕是否亮屏和是否解锁功能 03-27
- Android判断当前屏幕是全屏还是非全屏 05-27
- sora软件价格介绍 02-22
- sora官网入口地址一览 02-22
- Sora生成的视频使用教程 02-22