zoukankan      html  css  js  c++  java
  • 一手遮天 Android

    项目地址 https://github.com/webabcd/AndroidDemo
    作者 webabcd

    一手遮天 Android - view(自定义): 通过一个自定义 ViewGroup 来演示 measure, layout, draw

    示例如下:

    /view/custom/CustomView2Demo.java

    /**
     * 参见 view/custom/CustomView2.java
     * 通过一个自定义 ViewGroup 来演示 measure, layout, draw
     */
    
    package com.webabcd.androiddemo.view.custom;
    
    import androidx.appcompat.app.AppCompatActivity;
    import android.os.Bundle;
    
    import com.webabcd.androiddemo.R;
    
    public class CustomView2Demo extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_view_custom_customview2demo);
        }
    }
    
    

    /layout/activity_view_custom_customview2demo.xml

    <?xml version="1.0" encoding="utf-8"?>
    
    <!--
        CustomView2 - 继承 ViewGroup 实现一个自定义的 ViewGroup(用于演示 measure, layout, draw)
    -->
    <com.webabcd.androiddemo.view.custom.CustomView2 xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/red">
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAllCaps="false"
            android:text="button 1" />
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAllCaps="false"
            android:text="button 2" />
    
        <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAllCaps="false"
            android:text="button 3" />
    
    </com.webabcd.androiddemo.view.custom.CustomView2>
    

    项目地址 https://github.com/webabcd/AndroidDemo
    作者 webabcd

  • 相关阅读:
    Markdown语法帮助文档
    react-native-vector-icons使用方法
    如何创建Pull Request,以开源项目ant design pro为例
    4.环境变量总结篇
    3.Flutter之hello_world
    构建之法 阅读笔记03
    学习进度14
    团队项目-个人博客6.5
    团队项目-个人博客6.4
    构建之法 阅读笔记02
  • 原文地址:https://www.cnblogs.com/webabcd/p/android_view_custom_CustomView2Demo.html
Copyright © 2011-2022 走看看