view

自定义 View:Draw 过程

浪子不回头ぞ 提交于 2020-02-17 11:22:26
1、作用 作用:绘制 View。 2、Draw 过程 View 的绘制过程:draw()->drawBackground(绘制背景)->onDraw(绘制内容,重写)->dispatchDraw(绘制子view,空实现)->onDrawForeground(绘制装饰(滚动指示器、滚动条、前景等)) View.java public void draw(Canvas canvas) { final int privateFlags = mPrivateFlags; final boolean dirtyOpaque = (privateFlags & PFLAG_DIRTY_MASK) == PFLAG_DIRTY_OPAQUE && (mAttachInfo == null || !mAttachInfo.mIgnoreDirtyState); mPrivateFlags = (privateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN; /* * Draw traversal performs several drawing steps which must be executed * in the appropriate order: * * 1. Draw the background * 2. If necessary, save the

项目开发第三天

依然范特西╮ 提交于 2020-02-17 01:36:31
今天主要做收入支出的listview,recycleview展示方法。 package net.hnjdzy.tinyaccount.adapter; import java.util.List; import net.hnjdzy.tinyaccount.R; import net.hnjdzy.tinyaccount.entity.AccountItem; import android.app.Activity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; /** * 收入列表的适配器 * @author androiddev@163.com,hnjdzy */ public class AccountItemAdapter extends BaseAdapter { private List<AccountItem> mItems; private LayoutInflater mInflater; //构造函数 public

iOS-UIScrollView+UIPageControl简单实现

人走茶凉 提交于 2020-02-13 16:37:05
#import "MJViewController.h" #import "RootViewController.h" @interface MJViewController () <UIScrollViewDelegate> @property (strong, nonatomic) UIScrollView *scrollView; @property (strong, nonatomic) UIPageControl *pageControl; @property (strong, nonatomic) UIButton *nextBt; @end @implementation MJViewController - (void)viewDidLoad { [super viewDidLoad]; //初始化视图 NSArray *array = [NSArray arrayWithObjects:[UIColor redColor],[UIColor blueColor],[UIColor yellowColor],[UIColor purpleColor],[UIColor whiteColor], nil]; self.scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(10, 80, self.view

Getting the View that is receiving all the touch events

女生的网名这么多〃 提交于 2020-02-13 09:57:08
问题 I have a system overlay that sits above all Activities and Windows . The only problem is that it can only detect MotionEvents when a user places his/her down on the screen (it can't track the finger's movements or detects when the finger is lifted). As a possible solution, I've implemented a second view (I'll call it the tracking view) that is able to handle all the touch events, but stays hidden until a touch in the desired location is detected by the system overlay; in that event, it will

powerDesigner 把name项添加到注释(comment),完美方案!

拈花ヽ惹草 提交于 2020-02-10 23:58:21
第一次写博客,分享一点经验吧,平时大家用powerDesigner的时候,pd是不会把name项默认添加到comment的,所以生成的数据库表里面也没有中文字段的注释. 我在网上查了一下.有解决方案了. 以下是网上的解决方案,我把它完善了一下. '使用方法使用方法 'PowerDesigner->Tools->Execute Commands->Edit/Run Scripts 可以保存该脚本为:name2comment.vbs ' 把pd中那么name想自动添加到comment里面 ' 如果comment为空,则填入name;如果不为空,则保留不变,这样可以避免已有的注释丢失. Option Explicit ValidationMode = True InteractiveMode = im_Batch Dim mdl ' the current model ' get the current active model Set mdl = ActiveModel If (mdl Is Nothing ) Then MsgBox " There is no current Model " ElseIf Not mdl.IsKindOf(PdPDM.cls_Model) Then MsgBox " The current model is not an Physical Data

Django的url规则

大城市里の小女人 提交于 2020-02-09 07:47:51
利用Django开发网站,可以设计出非常优美的url规则,如果url的匹配规则(包含正则表达式)组织得比较好,view的结构就会比较清晰,比较容易维护。 最简单的形式 [python] view plain copy print? <code> from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^articles/2003/$', 'news.views.special_case_2003'), url(r'^articles/(\d{4})/$', 'news.views.year_archive'), url(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'), url(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'), )</code> 其中,正则表达式中组匹配出来的结果可以作为positional parameters传递给view. 如果url是www.yourdomain/articles/2005/,则会匹配第二条规则,执行news.views.year_archive('2005'). 注意点 域名部分会被过滤掉

Django--URL Caching Failing for Class Based Views

孤者浪人 提交于 2020-02-05 21:30:13
问题 I've built a RESTful API on top of the Django Rest Framework. The URL conf for the API is composed of class based views. I would like to cache these views, however, the following is failing. Any thoughts on why that might be and how I could change it? from django.views.decorators.cache import cache_page urlpatterns = patterns('', url(r'^dounces/?$', cache_page(60*60)(DounceListView.as_view(resource=DounceResource)), name='dounces_api'), I have the following middleware installed. 'django

Android UI can be created by code *AND* XML?

亡梦爱人 提交于 2020-02-05 06:49:35
问题 I am having trouble grasping a certain concept in Android UI design. The book I am referring to first uses the usual technique that Java programmers use to create UIs and that is to to create containers and add UI components to them and nest them as necessary. Now, the book introduces a new concept where the entire UI was created using an XML file. The code is pasted below: package com.oreilly.android.intro; import android.app.Activity; import android.os.Bundle; /** * Android UI demo program

Android UI can be created by code *AND* XML?

夙愿已清 提交于 2020-02-05 06:49:11
问题 I am having trouble grasping a certain concept in Android UI design. The book I am referring to first uses the usual technique that Java programmers use to create UIs and that is to to create containers and add UI components to them and nest them as necessary. Now, the book introduces a new concept where the entire UI was created using an XML file. The code is pasted below: package com.oreilly.android.intro; import android.app.Activity; import android.os.Bundle; /** * Android UI demo program