`
mickey_hou
  • 浏览: 243839 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

android layout attribute

阅读更多
第一类:属性值为true或false
android:layout_centerHrizontal 水平居中    
android:layout_centerVertical 垂直居中
android:layout_centerInparent 相对于父元素完全居中
android:layout_alignParentBottom 贴紧父元素的下边缘
android:layout_alignParentLeft 贴紧父元素的左边缘
android:layout_alignParentRight 贴紧父元素的右边缘
android:layout_alignParentTop 贴紧父元素的上边缘 android:layout_alignWithParentIfMissing如果对应的兄弟元素找不到的话就以父元素做参照

第二类:属性值必须为id的引用名“@id/id-name”
android:layout_below 在某元素的下方
android:layout_above 在某元素的的上方
android:layout_toLeftOf 在某元素的左边
android:layout_toRightOf 在某元素的右边
android:layout_alignTop 本元素的上边缘和某元素的的上边缘对齐
android:layout_alignLeft 本元素的左边缘和某元素的的左边缘对齐 android:layout_alignBottom本元素的下边缘和某元素的的下边缘对齐 android:layout_alignRight本元素的右边缘和某元素的的右边缘对齐


第三类:属性值为具体的像素值,如30dip,40px
android:layout_marginBottom 离某元素底边缘的距离
android:layout_marginLeft 离某元素左边缘的距离
android:layout_marginRight 离某元素右边缘的距离
android:layout_marginTop 离某元素上边缘的距离
分享到:
评论

相关推荐

    mono for android 之 自定义控件

    public static new readonly Android.Util.AttributeSet Attrs = Android.Attribute.GetStyleableResource(typeof(MyCustomButton)); public Color BackgroundColor { get => GetColorStateList(Resource.Color...

    Android代码-AndroidGradientUI

    First the custom attribute should declare in xml like this: xmlns:app="http://schemas.android.com/apk/res-auto" Then you can add GradientIconView in layout.xml The GradientIconView can gradient ...

    Android view构造方法第3个参数详解 demo

    在这个例子中,`android:background`和`android:text`是Android SDK提供的属性,而`custom:my_attribute`是自定义属性。在解析这个XML时,系统会调用`View(Context context, AttributeSet attrs)`构造方法,并传入...

    Android代码-Android流式标签布局

    A FlowLayout for Android, which allows child views flow to next row when there is no enough space. The spacing between child views can be calculated by the FlowLayout so that the views are evenly ...

    Android Activity在GridView和ListView之间切换使用一个布局实现的方法

    android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <!-- Title Bar --> android:id="@+id/app_grid" android:layout_width="fill_parent" ...

    Android代码-一个对安卓应用支持多种主题的库

    利用Android自身支持的不同Style中可复写相同的attribute的值的特性,通过代码动态设置不同的Style来达到不同主题的切换效果。它支持静态设置控件使用主题元素的方式——layout的xml中定义控件时使用,也支持程序...

    android demo,自定义LinearLayout的实现。

    android:layout_height="wrap_content" custom:customAttribute1="value1" custom:customAttribute2="value2"> <!-- 子视图 --> ``` 在Android Studio中,`test_ysy_self_difine_linearlayout`文件夹可能包含...

    android 自定义控件-编辑框

    android:layout_height="match_parent" android:orientation="vertical"> android:layout_width="match_parent" android:layout_height="wrap_content" app:customAttribute="value" /> </layout> ``` ...

    疯狂Android讲义源码

     6.6 使用布局(Layout)资源 239  6.7 使用菜单(Menu)资源 239  6.7.1 定义菜单资源 239  6.7.2 使用菜单资源 240  6.8 样式(Style)和主题(Theme)  资源 243  6.8.1 样式资源 243  6.8.2 主题资源 ...

    Android代码-一个搞笑的TabLayout库

    RecyclerTabLayout An efficient TabLayout library implemented with RecyclerView. Features Efficient when having many tabs ...Define RecyclerTabLayout in xml layout with custom attribute

    Android编程双重单选对话框布局实现与事件监听方法示例

    android:text="@string/attribute" android:id="@+id/radio2" /> android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/choice2" android:textColor="@...

    Android代码-SwipeStack

    A simple, customizable and easy to use swipeable view stack for Android. QuickStart Include the Gradle dependency dependencies { compile 'link.fls:swipestack:0.3.0' } Use it in your layout ...

    android自定义评分控件ratingbar

    android:layout_width="wrap_content" android:layout_height="wrap_content" app:starSize="24dp" <!-- 自定义属性 --> app:starSpacing="8dp" <!-- 自定义属性 --> app:max="5" <!-- 设置最大评分 --> /> ``...

    FormEditText文本验证提示

    android:layout_width="match_parent" android:layout_height="wrap_content" > .... <!-- Your actual layout --> .... Note: It's not mandatory to use it on the root element. Also remember to change ...

    安卓Android源码——MyImageView2.rar

    android:layout_height="wrap_content" app:customAttribute1="value1" app:customAttribute2="value2" /> ``` 这里,`app:`前缀是自定义属性的命名空间,`customAttribute1`和`customAttribute2`是我们在`...

    Android代码-StatusView

    Custom status view for Android. Usage Add to XML If you want to use ConnectionStatusView If you want to use your own layout for status Then call status method statusView.setStatus(Status.LOADING); ...

    android笔记

    android:layout_height="wrap_content"/> ``` 在这个示例中,我们定义了一个`TextView`用于显示标题,并设置其宽度为匹配父容器,高度为包裹内容;同时,还定义了一个`ImageView`用于显示图片。 综上所述,这些...

    android-viewflow

    android:layout_width="wrap_content" android:id="@+id/viewflowindic" android:background="#00000000"/> And then you'll need to connect your ViewFlow with the FlowIndicator: CircleFlowIndicator indic ...

Global site tag (gtag.js) - Google Analytics