您好,登錄后才能下訂單哦!
本篇文章給大家分享的是有關(guān)Android應(yīng)用中如何將ButtonBar放到屏幕底部,小編覺(jué)得挺實(shí)用的,因此分享給大家學(xué)習(xí),希望大家閱讀完這篇文章后可以有所收獲,話不多說(shuō),跟著小編一起來(lái)看看吧。
要涉及這樣的一個(gè)buttonbar,主要就是要用到這個(gè)風(fēng)格。首先還是來(lái)看xml的設(shè)計(jì),保存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 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>
然后就是關(guān)于這個(gè)的全部代碼了:
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"); } }
以上就是Android應(yīng)用中如何將ButtonBar放到屏幕底部,小編相信有部分知識(shí)點(diǎn)可能是我們?nèi)粘9ぷ鲿?huì)見(jiàn)到或用到的。希望你能通過(guò)這篇文章學(xué)到更多知識(shí)。更多詳情敬請(qǐng)關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。