android 中常用的xml语句(不定时更新中)

1.在AndroidManifest android:screenOrientation="portrait"

表示当我们切换横竖屏的时候,屏幕的内容始终以竖屏显示,而不会根据屏幕的方向来显示内容

2.android:divider  子布局之间的分割线

包括android:dividerHeight 分割线的高度

用法举例:https://blog.csdn.net/xiaomai949804781/article/details/53894974

当然也可以用在ListView中用于子item的分割线

<com.always.library.View.MyListView 
android:id="@+id/listview_info" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginBottom="@dimen/layout_padd" android:divider="@color/defcolor_gray" android:dividerHeight="1px"
android:paddingHorizontal
="@dimen/layout_padd"/>

 3.textview单行显示多出的省略号显示

<TextView android:layout_width="wrap_content" 
          android:layout_height="wrap_content"
          android:id="@+id/hello" 
          android:ellipsize="end"
          android:singleLine="true" 
/>

 

android:scaleType=“fitXY”              将原图进行横方向(即XY方向)的拉伸后绘制的

android:orientation="vertical"        此时的排列方式为垂直方向

android:orientation="horizontal"      表示此时的排列方式为水平方向

android:layout_alignParentBottom    贴紧父元素的下边缘

android:gravity="center_vertical"      限定它里面的内容要 垂直居中 显示。

android:layout_weight       把剩余内容按照权重来进行分配

android:orientation  只有线性布局才有,相对布局不需要使用

android:state_pressed       是当控件被按下的时候控件的表示,可以实现按下按钮时

android:state_focused               是当控件获得焦点的时候控件的表示。

android:state_selected                  选中时控件的表示。

posted @ 2020-12-14 14:54  null_lii  阅读(164)  评论(0)    收藏  举报