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

  • 相关阅读:
    Java序列化原理
    分库分表
    数据库索引
    监听TCP端口号:从简单Socket到NIO到Netty
    如何保证缓存与数据库的双写一致性
    代理模式:静态代理、JDK动态代理、Cglib动态代理
    Redis发布订阅(Pub-Sub)模式
    Redis分片机制(Sharding)
    Redis高可用性:主从、哨兵和集群
    Redis简介
  • 原文地址:https://www.cnblogs.com/webabcd/p/android_view_custom_CustomView2Demo.html
Copyright © 2011-2022 走看看