亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android編程實現(xiàn)將ButtonBar放在屏幕底部的方法

 更新時間:2017年03月01日 10:47:17   作者:aloxc  
這篇文章主要介紹了Android編程實現(xiàn)將ButtonBar放在屏幕底部的方法,涉及Android界面設計與文本操作相關技巧,需要的朋友可以參考下

本文實例講述了Android編程實現(xiàn)將ButtonBar放在屏幕底部的方法。分享給大家供大家參考,具體如下:

前面一篇《Android編程實現(xiàn)將tab選項卡放在屏幕底部的方法》提到ButtonBar的方式寫底部button,試了試,看起來外觀貌似比Tab好看,不過恐怕沒有Tab管理Activity方便吧,畢竟一 個Tab就是一個Activity,但是這樣用Button的話,卻并不如此,所以這樣的涉及可能雖然好看點,但是管理起來卻是相當麻煩。那么暫且把對 activity的管理放在一邊,只看界面的設計吧。

要涉及這樣的一個buttonbar,主要就是要用到style="@android:style/ButtonBar"這個風格。首先還是來看xml的設計,保存layout/bottombtn.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical" android:layout_width="fill_parent"
  android:layout_height="fill_parent">
  <TextView android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:id="@+id/textOut"
    android:padding="5px" android:layout_weight="1"/>
  <LinearLayout style="@android:style/ButtonBar"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:orientation="horizontal">
    <Button android:id="@+id/button_weather" android:text="@string/bottom_weather"
      android:layout_width="0dip" android:layout_height="wrap_content"
      android:layout_weight="1"/>
    <Button android:id="@+id/button_mail" android:text="@string/bottom_mail"
      android:layout_width="0dip" android:layout_height="wrap_content"
      android:layout_weight="1"/>
    <Button android:id="@+id/button_train" android:text="@string/bottom_train"
      android:layout_width="0dip" android:layout_height="wrap_content"
      android:layout_weight="1"/>
    <Button android:id="@+id/button_sites" android:text="@string/bottom_sites"
      android:layout_width="0dip" android:layout_height="wrap_content"
      android:layout_weight="1"/>
    <Button android:id="@+id/button_stock" android:text="@string/bottom_stock"
      android:layout_width="0dip" android:layout_height="wrap_content"
       android:layout_weight="1"/>
  </LinearLayout>
</LinearLayout>

然后就是關于這個的全部代碼了:

package net.wangliping.popup;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class BottomBtn extends Activity {
  private static String LOG_TAG = "BottomBtn";
  private TextView tv;
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bottombtn);
    tv = (TextView)findViewById(R.id.textOut);
    tv.setText("http://tools.wangliping.net");
  }
}

如此這般,就形成了下面的這個東西,雖然界面上看起來稍微美觀一點,還是上面那句話:管理器Activity不一定很方便哦。

更多關于Android相關內容感興趣的讀者可查看本站專題:《Android開發(fā)入門與進階教程》、《Android調試技巧與常見問題解決方法匯總》、《Android基本組件用法總結》、《Android視圖View技巧總結》、《Android布局layout技巧總結》及《Android控件用法總結

希望本文所述對大家Android程序設計有所幫助。

相關文章

  • Android后臺定時提醒功能實現(xiàn)

    Android后臺定時提醒功能實現(xiàn)

    這篇文章主要介紹了Android后臺定時提醒功能,針對Service,AlarmManager的使用進行詳細闡述,感興趣的小伙伴們可以參考一下
    2016-01-01
  • Android中imageview.ScaleType使用方法詳細介紹

    Android中imageview.ScaleType使用方法詳細介紹

    這篇文章主要介紹了Android中imageview.ScaleType使用方法詳細介紹的相關資料,需要的朋友可以參考下
    2017-06-06
  • 基于SQLite的Android登錄APP

    基于SQLite的Android登錄APP

    這篇文章主要為大家詳細介紹了基于SQLite的Android登錄APP,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-01-01
  • Android 應用中插入廣告的實例

    Android 應用中插入廣告的實例

    本文主要介紹Android應用中插入廣告,這里提供了詳細的資料及實現(xiàn)示例代碼,有興趣的小伙伴可以參考下
    2016-08-08
  • 僅4行代碼實現(xiàn)Android快速文件下載

    僅4行代碼實現(xiàn)Android快速文件下載

    僅4行代碼實現(xiàn)Android快速文件下載,這篇文章主要為大家詳細介紹了Android實現(xiàn)快速文件下載功能的方法,感興趣的小伙伴們可以參考一下
    2016-07-07
  • Android 進階實現(xiàn)性能優(yōu)化之OOM與Leakcanary詳解原理

    Android 進階實現(xiàn)性能優(yōu)化之OOM與Leakcanary詳解原理

    LeakCanary 是大名鼎鼎的 square 公司開源的內存泄漏檢測工具。目前上大部分App在開發(fā)測試階段都會接入此工具用于檢測潛在的內存泄漏問題,做的好一點的可能會搭建一個服務器用于保存各個設備上的內存泄漏問題再集中處理
    2021-11-11
  • android實現(xiàn)彈出提示框

    android實現(xiàn)彈出提示框

    這篇文章主要為大家詳細介紹了android實現(xiàn)彈出提示框,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-01-01
  • 點擊微信內網頁a標簽直接跳轉打開淘寶APP的方法實例

    點擊微信內網頁a標簽直接跳轉打開淘寶APP的方法實例

    這篇文章主要給大家介紹了關于如何實現(xiàn)點擊微信內網頁a標簽直接跳轉打開淘寶APP的相關資料,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面來一起看看吧。
    2017-11-11
  • Android基于Fresco實現(xiàn)圓角和圓形圖片

    Android基于Fresco實現(xiàn)圓角和圓形圖片

    這篇文章主要為大家詳細介紹了Android基于Fresco實現(xiàn)圓角和圓形圖片,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-04-04
  • Android適配底部虛擬按鍵的方法詳解

    Android適配底部虛擬按鍵的方法詳解

    今天小編就為大家分享一篇Android適配底部虛擬按鍵的方法詳解,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-07-07

最新評論