本文来自投稿,不代表长河网立场,转载请注明出处: http://www.changhe99.com/a/y26WmqRwP7.html
图解android开发View中的线性布局:[4],adroid开发中view的布局有几种方法,分别是线性布局(LiearLayout)、相对布局RelativeLayout、表格布局(TaleLayout)、标签布局(TaLayout)、绝对布局(AoluteLayout)。先一起学习线性布局(LiearLayout)。
android开发中view的布局有几种方法,分别是线性布局(LinearLayout)、相对布局(RelativeLayout)、表格布局(TableLayout)、标签布局(TabLayout)、绝对布局(AbsoluteLayout)。先一起学习线性布局(LinearLayout)。工具/原料电脑eclipse方法/步骤1线性布局(LinearLayout)是一个viewgroup以线性方向显示它的子视图元素。在xml中写入以下代码。(指方向是垂直的) (在strings.xml中定义按钮) 步骤阅读2在mainactivity.java中写入以下代码:packagecom.ddexample.dh1;importandroid.os.Bundle;importandroid.support.v7.app.ActionBarActivity;publicclassMainActivityextendsActionBarActivity{ @Override protectedvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); }}步骤阅读3在strings.xml中写入以下代码: Dh1 Settings ActivityB button1 button2 button3 button4 button5步骤阅读4然后直接运行这个android工程,就能得到一个具有线性布局界面了,里面有五个按钮。步骤阅读步骤阅读5 android:orientation=\"horizontal\">(指方向是垂直的),如果把其值改为vertical,就变为水平了。步骤阅读步骤阅读END图解android开发View中的线性布局(共1篇)
赞
(0)