首页 > 编程知识 正文

四种基本相互作用,杆件的四种基本变形

时间:2023-05-03 15:36:35 阅读:208770 作者:2543

1.LinearLayout //线性布局

android:orientation=""  //设置控件的排列方式 horizontal 垂直  vertical 水平   <EditText        android:id="@+id/edit_text"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="1"         //在页面按比例布局        android:hint="type something"        />       <Button         android:id="@+id/button"         android:layout_width="0dp"         android:layout_height="wrap_content"         android:layout_weight="1"         android:text="send"         /> 显示: ___【】   若改成 <EditText        android:id="@+id/edit_text"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="1"        android:hint="type something"        />    //edit_text会占满剩余屏幕       <Button         android:id="@+id/button"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="send"         /> 显示: __________【】     2.RelativeLayout  //相对布局 在页面布局: android:layout_alignParentLeft+ android:layout_alignParen Top:左上 android:layout_alignParenRight+ android:layout_alignParen Bottom:右下  android:layout_centerInParent:居中   相对控件布局: //在button3右上 android:layout_above="@id/button3" android:layout_toRightOf="@id/button3"   // 在button3左下 android:layout_below="@id/button3" android:layout_toLeftOf="@id/button3"   //与button3左边缘对齐 android:layout_alignLeft="@id/button3" //与button3上端对齐 android:layout_alignTop="@id/button3"   3.TableLayout  //表格布局   <TableLayout     。。。
android:stretchColumns="1"   //延伸第二格以填充空白   0表示第一格
>   <TableRow>         <TextView             android:layout_height="wrap_content"             android:text="Account:"             />         <EditText             android:id="@+id/account"             android:layout_height="wrap_content"             android:hint="Input your account"                         />             </TableRow>       <TableRow>         <TextView             android:layout_height="wrap_content"             android:text="Password:"             />         <EditText             android:id="@+id/password"             android:layout_height="wrap_content"             android:inputType="textPassword"             />     </TableRow>             <TableRow>         <Button             android:id="@+id/login"             android:layout_height="wrap_content"             android:layout_span="2"      //合并单元格             android:text="login"             />     </TableRow>   显示: Account:  ______________ Password:______________
【               login          】   2.各控件所占比例可通过 如weightSum="1"(总比例) 和         android:layout_weight="(内填比例)"

 控制

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。