随手记录20160721

来源:互联网 发布:软件系统模块化设计 编辑:程序博客网 时间:2024/05/20 23:33

//[1]stretch

v. 伸展; 延伸; 持续; 包括;n. 伸展; 弹性; 一片; 一段时间;adj. 可伸缩的; 弹性的;



align
vt.
使成一线,使结盟; 排整齐;
vi.
排列; 成一条线;
[例句]There are signs that the prime minister is aligning himself with the liberals
有迹象表明首相正在与自由党人结盟。




//[2]

android:layout_below="@+id/imageButton0"  

android:layout_alignLeft="@+id/imageButton0"//对这种写法表示怀疑


android @+id @id 的区别:


@+id/xxx 是新添加一个int id值;例如: android:id="@+id/imageButton2"


@id/xxx 是在调用 android:layout_below 、 android:layout_alignLeft 之类的相对布局的时候用来确定本控件处于 xxx控件的某个方向上;


[特殊情况]:当在使用RelativeLayout 布局时,如图所示:

分别为 5 个ImageView什么时候用到@+id/xxx 来指定布局位置而不是给一个控件设置id呢?如下

;当ImageView4 还没有定义前,也就是 imageView0 的定义xml代码在 imageView4 的前面,imageView0就可以这么写

 

android:layout_toLeftOf="@+id/imageButton4"
;我觉得应该是这样,但是现在 在AndroidStudio中 不写其中的‘+’也正确,可能是androidstudio优化了,而eclipse没有优化的原因吧,


//下面是一段无管紧要的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">    <!-- 添加顶部图片 -->    <ImageView android:layout_width="match_parent"        android:id="@+id/imageButton5"        android:layout_height="wrap_content"        android:scaleType="centerCrop"        android:layout_weight="1"        android:src="@drawable/top" />    <!-- 添加一个相对布局管理器 -->    <RelativeLayout android:layout_weight="2"        android:layout_height="wrap_content"        android:background="@drawable/bottom"        android:id="@+id/relativeLayout1"        android:layout_width="match_parent">        <!-- 添中间位置的图片 -->        <ImageView android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/imageButton0"            android:src="@drawable/in"            android:layout_centerInParent="true" />        <!-- 添加上方显示的图片 -->        <ImageView android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/imageButton1"            android:src="@drawable/setting"            android:layout_above="@id/imageButton0"            android:layout_alignRight="@id/imageButton0" />        <!-- 添加下方显示的图片 -->        <ImageView android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/imageButton2"            android:src="@drawable/exit"            android:layout_below="@+id/imageButton0"            android:layout_alignLeft="@+id/imageButton0" />        <!-- 添加左侧方显示的图片 -->        <ImageView android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/imageButton3"            android:src="@drawable/help"            android:layout_toLeftOf="@+id/imageButton0"            android:layout_alignTop="@+id/imageButton0" />        <!-- 添加右侧显示的图片 -->        <ImageView android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:id="@+id/imageButton4"            android:src="@drawable/board"            android:layout_toRightOf="@+id/imageButton0"            android:layout_alignTop="@+id/imageButton0" />    </RelativeLayout></LinearLayout>


0 0
原创粉丝点击