今天学习了安卓Studio的基本知识点:控件,排列,简单的逻辑关系

 

一.
常用控件:

1. TextView(文本框)
2. ImageView(图片框)
3. Button(按钮)


二,
layout->长宽

按照内容安排控件长宽:
android:layout_width="wrap_content"
android:layout_height="wrap_content"

剩余空间的长宽:
android:layout_width="match_parent"
android:layout_height="match_parent"

(也可以给固定的值如:50dp)


三,
如何放入图片?
将图片放在 res/drawable 下

如何调用图片?
图片空间中写 android:src="@drawable/map" (map为图片名)

四,
为控件添加id:
android:id="@+id/tv" (tv为id名)


五,
Button

按钮上的字:
android:text="点击打开"

文本框上的字也是text.

六,

1.
线性布局: LinearLayout

2.
垂直排序: android:orientation="vertical"
水平排序: android:orientation="horizontal"

 

 

1.
背景:
background
@android:color/background_dark -->纯黑色


2.
对齐方式:

相对于自己:
gravity

相对于父控件:
layout_gravity

值:center


3.行边距:
padding 单位:dp


4.
剩余空间权重占比
layout_weight:1

  

更多相关文章

  1. 剪切图片-扩展android 选择图片(从手机照相机或手机图片)
  2. Android 如何通过menu id来得到menu item 控件
  3. android 各类开源项目整理 包括 个性化控件 工具库 完整优秀项目
  4. android Gallery实现加载网络图片
  5. Android使用AsyncTask下载图片,最好使用WeakReference
  6. 情况控件Android layout_weight用法图解
  7. Android 打开相机、相册获取图片文件,支持Android 9.0系统
  8. android中调用系统功能 来显示本地相册图片 拍照 视频 音频功能
  9. Android中欢迎界面背景图片放大效果

随机推荐

  1. Android 断点续传
  2. Android(安卓)TextView drawText BaseLin
  3. API 25 (Android 7.1.1 API) widget.Spin
  4. Android sensor 理解及架构
  5. android 滚动的缓冲图片
  6. Android Untold Stories --- Selector an
  7. android ---- ImageUtil工具类
  8. android开发【六】(基于android studio3.2
  9. Android CardView设置成普通的Framelayou
  10. Setting up ccache on android 4.0.3