Android模仿Buttonbar(style="@android:style/ButtonBar")
2010-12-10 10:12
501 查看
要涉及这样的一个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" mce_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>
然后就是关于这个的全部代码了:
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"); }}
相关文章推荐
- Buttons in button bars should be borderless; use style="?android:attr/buttonBarButtonStyle" (and ?an
- Buttons in button bars should be borderless; use style="?android:attr/buttonBarButtonStyle" (and ?an
- Android的ProgressBar样式||||||style="?android:attr/progressBarStyleSmall"|||系统预置定义样式的用法是?android:attr/x
- 安卓 style="?android:attr/progressBarStyleSmall"表示的含义
- <style name="Base.Widget.AppCompat.ActionButton" parent="android:Widget.Material.Acti
- android:theme="@android:style/Theme.NoTitleBar"
- error: Attribute "buttonBarStyle" has already been defined
- 去掉Actionbar左侧的图标<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar"> <it
- 安卓 style="?android:attr/progressBarStyleSmall"表示的含义
- android中TextView中文字体粗体的方法 (android:textStyle="bold")
- android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen"设置全屏程序闪退解决办法
- android全屏设置代码:android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
- android:onClick="onMyButtonClick"
- 项目中添加 android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"应用崩溃
- onMouseOut="chanageButtonStyle(this, 'btn1');"
- 关于android xml文件中 android:id="@+id/my_button"的含义疑问
- Android中使用AlertDialog,使用函数setButton()出现的关于“new OnClickListener"错误
- android 中 style="?android:attr/ratingBarStyleSmall" 是什么意思
- java.lang.IllegalStateException: ActionBarContextView can only be used with android:layout_width="
- Android加载so出现dlopen failed: empty/missing DT_HASH in "libx.so" (built with --hash-style=gnu?)错误