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

  • 相关阅读:
    HDU 5528 Count a * b 欧拉函数
    HDU 5534 Partial Tree 完全背包
    HDU 5536 Chip Factory Trie
    HDU 5510 Bazinga KMP
    HDU 4821 String 字符串哈希
    HDU 4814 Golden Radio Base 模拟
    LA 6538 Dinner Coming Soon DP
    HDU 4781 Assignment For Princess 构造
    LA 7056 Colorful Toy Polya定理
    LA 6540 Fibonacci Tree
  • 原文地址:https://www.cnblogs.com/webabcd/p/android_view_custom_CustomView2Demo.html
Copyright © 2011-2022 走看看