android之旅(一)简单布局
16lz
2021-01-26
今天我们开始android之旅,由于本人现在水平还很菜,只能从简单的做起,希望各位老鸟多多指点;今天我们要学的是android的布局,各种布局管理器
先看效果图:
代码如下:
main.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="wrap_content"> <Button android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="上" /> <!-- 向线性布局中添加一个普通按钮控件 --><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" > <!-- 向线性布局中添加一个水平的线性布局 --> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="左下" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="右下" /> </LinearLayout></LinearLayout>
实现的功能:
package com.qinweiping;import android.app.Activity;import android.os.Bundle;public class Sample_2_1Activity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); }}
更多相关文章
- Android(安卓)ListView 之 SimpleAdapter 一
- Android(安卓)内存泄漏LeakCanary使用详解
- Android入门之addWindow
- Android(安卓)listview多选模式ChoiceMode
- 在Android(安卓)Studio上使用lambda
- Android动态设置控件大小
- Android(安卓)Fragment实践之简易的新闻应用
- 记android输入框添加删除功能
- Android(安卓)ListView分页加载数据Demo