hyljava

          #

          廣禾養(yǎng)老文化村

          廣禾養(yǎng)老文化村
          首頁(yè)地址http://202.199.162.210:8080/IntelligentNursing/index/toIndex
          展示效果

           
           


          posted @ 2014-08-26 16:18 何云隆| 編輯 收藏

          打開(kāi)eclipse彈出Error:could not open D:\java\lib\i386\jvm.cfg'

          打開(kāi)eclipse彈出Error:could not open D:\java\lib\i386\jvm.cfg'
          運(yùn)行中 輸入regedit 
           
          沒(méi)有修改注冊(cè)表,解決辦法是: 
          重新安裝JDK時(shí)注冊(cè)表中\(zhòng)HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environemt\1.6 項(xiàng)目下的JavaHome和RuntimeLib設(shè)置沒(méi)有更新,將這兩個(gè)項(xiàng)目更正即可.
           
           

          posted @ 2014-05-24 22:05 何云隆 閱讀(548) | 評(píng)論 (0)編輯 收藏

          安裝Eclipse Html Editor

          安裝Eclipse Html Editor 轉(zhuǎn)

          分類: Java 1431人閱讀 評(píng)論(0) 收藏 舉報(bào)
            最近在eclipse中開(kāi)發(fā)android項(xiàng)目,用到了jquery mobile框架,則會(huì)涉及到新建html文件,發(fā)現(xiàn)eclipse不自帶新建html文件的插件,必須得新建一個(gè)其他形式的文件,譬如xml格式的文件,然后重命名,后綴名改成html,覺(jué)得這樣老麻煩的,所以在網(wǎng)上發(fā)現(xiàn)了Eclipse HTML Editor,不過(guò)此插件似乎只支持新建html文件,不支持其格式化。網(wǎng)上看了其他一個(gè)html格式化的插件Eclipse Tidy,不過(guò)用了后,發(fā)現(xiàn)格式化后的html一點(diǎn)都不符合代碼審讀標(biāo)準(zhǔn)。也不知道是不是自己哪邊沒(méi)設(shè)置好,還是本來(lái)就是那樣。

             現(xiàn)在就暫先不管Eclipse Tidy了,看看如何安裝Eclipse HTML Editor。

          1.下載GEF(依賴包):

          http://www.eclipse.org/downloads/download.php?file=/tools/gef/downloads/drops/3.7.2/R201201171043/GEF-ALL-3.7.2.zip

          然后解壓,把解壓得到的features和plugins兩文件夾放到eclipse安裝目錄下plugins文件夾中

          2.下載HTMLEditor

          http://amateras.sourceforge.jp/cgi-bin/fswiki_en/wiki.cgi?page=EclipseHTMLEditor

          只有一個(gè)tk.eclipse.plugin.htmleditor_2.1.0.jar文件

          直接復(fù)制到eclipse\plugins里面

          posted @ 2014-04-03 15:15 何云隆 閱讀(177) | 評(píng)論 (0)編輯 收藏

          mysql 解決全連接問(wèn)題

               摘要: 基本資料:mysql> select version();+-----------+| version() |+-----------+| 5.0.16 |+-----------+ mysql> select * from t1;+----+------+| id | name |+----+------+| 1 | aa || 2 | bb || 3 | cc |+---...  閱讀全文

          posted @ 2014-03-03 19:30 何云隆 閱讀(352) | 評(píng)論 (0)編輯 收藏

          ListView實(shí)現(xiàn)RadioButton的功能有bug改進(jìn)

          前言:之前做的ListView實(shí)現(xiàn)RadioButton的功能有bug,當(dāng)ListView控件的內(nèi)容超出屏幕可見(jiàn)區(qū)域時(shí),滑動(dòng)ListView控件會(huì)報(bào)錯(cuò),下面有為什么出錯(cuò)和解決方法進(jìn)行的注解,不多說(shuō)了,看源碼,有更好的解決辦法請(qǐng)指教

          1,MainActivity.java

          package com.excetop.listradio;

          import android.app.Activity;
          import android.os.Bundle;
          import android.util.Log;
          import android.view.View;
          import android.view.ViewGroup;
          import android.widget.BaseAdapter;
          import android.widget.Button;
          import android.widget.CompoundButton;
          import android.widget.ListView;
          import android.widget.RadioButton;
          import android.widget.CompoundButton.OnCheckedChangeListener;

          public class MainActivity extends Activity {
              private static final String TAG = "MainActivity";
              private ListView listView;
              @Override
              public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.main);
                  listView = (ListView) this.findViewById(R.id.list);
                  MyAdapter adapter = new MyAdapter();
                  listView.setAdapter(adapter);
              }
              private class MyAdapter extends BaseAdapter{
                  private String[] s = new String[]{"a","b","c","d","e","a","b","c","d","e","a","b","c","d","e","a","b","c","d","e"};
                  private int temp = -1;

                  @Override
                  public int getCount() {
                      // TODO Auto-generated method stub
                      return s.length;
                  }

                  @Override
                  public Object getItem(int position) {
                      // TODO Auto-generated method stub
                      return null;
                  }

                  @Override
                  public long getItemId(int position) {
                      // TODO Auto-generated method stub
                      return 0;
                  }

                  @Override
                  public View getView(int position, View convertView, ViewGroup parent) {
                      convertView = MainActivity.this.getLayoutInflater().inflate(R.layout.item, null);  //解決辦法: 每次都重新獲取View
                      Button button = (Button) convertView.findViewById(R.id.button);
                      button.setText(s[position]);
                      RadioButton radioButton = (RadioButton) convertView.findViewById(R.id.radioButton);
                      radioButton.setId(position);  //把position設(shè)為radioButton的id
                      radioButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
                          
                          @Override
                          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                              
                              if(isChecked){
                                  //這段代碼來(lái)實(shí)現(xiàn)單選功能
                                  if(temp != -1){
                                      RadioButton tempButton = (RadioButton) MainActivity.this.findViewById(temp);
                                      if(tempButton != null){
                                         tempButton.setChecked(false);
                                      }
                                      
                                  }
                                  
                                  temp = buttonView.getId();
                                  Log.i(TAG,"you are women- -   " + isChecked + "   " + temp);
                                  
                              }
                          }
                      });
                      
                      //這里實(shí)現(xiàn)單選框選的回顯,解決了單選框移出屏幕范圍未選中狀態(tài)
                      if(temp == position){
                          radioButton.setChecked(true);
                      }
                      return convertView;
                  }
          //            Holder holder;
          //            if(convertView == null){    //1,當(dāng)?shù)谝淮渭虞dListView控件時(shí)  convertView為空 
          //                convertView = MainActivity.this.getLayoutInflater().inflate(R.layout.item, null); //所以當(dāng)ListView控件沒(méi)有滑動(dòng)時(shí)都會(huì)執(zhí)行這條語(yǔ)句
          //                holder = new Holder();
          //                convertView.setTag(holder);
          //            }else{
          //                holder = (Holder) convertView.getTag();
          //            }
          //            
          //            holder.button = (Button) convertView.findViewById(R.id.button);
          //            holder.button.setText(s[position]);
          //            
          //            holder.radioButton = (RadioButton) convertView.findViewById(R.id.radioButton);   //
          //            holder.radioButton.setId(position);  //2,因?yàn)檫@里對(duì)radioButton的id進(jìn)行重新設(shè)置,滑動(dòng)ListView時(shí)convertView不為空,上面的語(yǔ)句就沒(méi)法得到radioButton對(duì)象,這條語(yǔ)句就會(huì)報(bào)空指針異常
                    
          //            holder.radioButton.setOnCheckedChangeListener(new OnCheckedChangeListener() {
          //                
          //                @Override
          //                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
          //                    
          //                    if(isChecked){
          //                        if(temp != -1){
          //                            RadioButton tempButton = (RadioButton) MainActivity.this.findViewById(temp);
          //                            tempButton.setChecked(false);
          //                            
          //                        }
          //                        
          //                        temp = buttonView.getId();
          //                        Log.i(TAG,"you are women- -   " + isChecked + "   " + temp);
          //                        
          //                    }
          //                }
          //            });
          //            return convertView;
          //        }
          //        private class Holder{
          //            private Button button;
          //            private RadioButton radioButton;
          //        }
              }
          }

          2,item.xml

          <?xml version="1.0" encoding="utf-8"?>
          <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <Button
              android:id="@+id/button"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="測(cè)試">
            
            </Button>
            
            <RadioButton
              android:id="@+id/radioButton"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              />  
           
          </LinearLayout>
          3, main.xml

          <?xml version="1.0" encoding="utf-8"?>
          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              >
          <TextView  
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:text="@string/hello"
              />
              <ListView
                 android:id="@+id/list"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
                 />
          </LinearLayout>

          posted @ 2014-02-22 22:58 何云隆 閱讀(259) | 評(píng)論 (0)編輯 收藏

          listview與checkbox組合使用

          一,Layout

           

          1,main.xml

          <?xml version="1.0" encoding="utf-8"?>
          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              >
          <TextView  
              android:layout_width="fill_parent" 
              android:layout_height="wrap_content" 
              android:text="@string/hello"
              />
              <ListView
                 android:id="@+id/list"
                 android:layout_width="fill_parent"
                 android:layout_height="fill_parent"
                 />
          </LinearLayout>

           

          2,item.xml

          <?xml version="1.0" encoding="utf-8"?>
          <LinearLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <Button
              android:id="@+id/button"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="測(cè)試">
            
            </Button>
            
            <CheckBox
              android:id="@+id/checkBox"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              />  
           
          </LinearLayout>

          二,Activity

           

          1,MainActivity

          package com.excetop.listradio;

          import java.util.ArrayList;
          import java.util.HashMap;
          import java.util.List;
          import java.util.Map;

          import android.app.Activity;
          import android.os.Bundle;
          import android.util.Log;
          import android.view.View;
          import android.view.ViewGroup;
          import android.widget.BaseAdapter;
          import android.widget.Button;
          import android.widget.CheckBox;
          import android.widget.CompoundButton;
          import android.widget.ListView;
          import android.widget.Toast;
          import android.widget.CompoundButton.OnCheckedChangeListener;

          public class MainActivity extends Activity {
           private static final String TAG = "MainActivity";
              private ListView listView;
              private Map checkMap;
           @Override
              public void onCreate(Bundle savedInstanceState) {
                  super.onCreate(savedInstanceState);
                  setContentView(R.layout.main);
                  listView = (ListView) this.findViewById(R.id.list);
                  
                  checkMap = new HashMap<String, Object>();
                  
                  MyAdapter adapter = new MyAdapter();
                  listView.setAdapter(adapter);
                
              }
           private class MyAdapter extends BaseAdapter{
            private String[] s = new String[]{"a","b","c","d","e","a","b","c","d","e","a","b","c","d","e","a","b","c","d","e"};

            @Override
            public int getCount() {
             // TODO Auto-generated method stub
             return s.length;
            }

            @Override
            public Object getItem(int position) {
             // TODO Auto-generated method stub
             return null;
            }

            @Override
            public long getItemId(int position) {
             // TODO Auto-generated method stub
             return 0;
            }

            @Override
            public View getView(int position, View convertView, ViewGroup parent) {
             convertView = MainActivity.this.getLayoutInflater().inflate(R.layout.item, null);  //解決辦法: 每次都重新獲取View
             Button button = (Button) convertView.findViewById(R.id.button);
             button.setText(s[position]);
             final CheckBox checkBox =  (CheckBox) convertView.findViewById(R.id.checkBox);
             checkBox.setId(position);  //把position設(shè)為radioButton的id
             checkBox.setOnCheckedChangeListener(new OnCheckedChangeListener() {
              
              @Override
              public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
               
               if(isChecked){
                
                checkMap.put(String.valueOf(checkBox.getId()), checkBox.getId());
          //      Toast.makeText(MainActivity.this, String.valueOf( checkBox.getId()), 0).show();
               
               }else{
                checkMap.remove(String.valueOf(checkBox.getId()));
          //      Toast.makeText(MainActivity.this, String.valueOf( checkBox.getId()), 0).show();
               }
              }
             });
             
             if(checkMap.get(String.valueOf(position)) != null){
              checkBox.setChecked(true);
          //    Toast.makeText(MainActivity.this, String.valueOf(String.valueOf(position)), 0).show();
             }
             
             //這里實(shí)現(xiàn)單選框選的回顯,解決了單選框移出屏幕范圍未選中狀態(tài)
             return convertView;
            }
           }
          }

          posted @ 2014-02-22 22:56 何云隆 閱讀(222) | 評(píng)論 (0)編輯 收藏

          處理多個(gè)fragment之間replace刷新問(wèn)題

           處理多個(gè)fragment之間replace刷新問(wèn)題[轉(zhuǎn)]
           每次創(chuàng)建fragment對(duì)象都會(huì)重新走onCreateView方法,所以多個(gè)fragment互相替換會(huì)重新刷新界面,
           在application中創(chuàng)建一個(gè)View,保持onCreateVIew中創(chuàng)建的View
           每次走onCreateView的時(shí)候判斷application中是否保持了View,如果為null,重新inflater走initView和initData方法,不為nul得到父類,移除子View,不然有父id無(wú)法再加入布局中,
           以下是代碼:
           @Override
           public View onCreateView(LayoutInflater inflater, ViewGroup container,
             Bundle savedInstanceState) {
            
            GalaxyApplication galaxyApplication = (GalaxyApplication) getActivity().getApplication();
            View recommendView = galaxyApplication.getRecommendView();
            if(recommendView != null){
             
             ViewGroup group = (ViewGroup) recommendView.getParent();
             group.removeAllViews();
             
             return recommendView;
            }
            
            View fmRootView = inflater.inflate(R.layout.fragment_recommend, container,false);
            
            
           
            
            initView(fmRootView);
            initData();
            galaxyApplication.setRecommendView(fmRootView);
            Logger.d("fragment: ", "onCreateView");
            return fmRootView;
           } 

           如有好的方法,處理onCreateView刷新問(wèn)題  歡迎留言。 

          posted @ 2014-02-22 22:55 何云隆 閱讀(556) | 評(píng)論 (0)編輯 收藏

          android設(shè)置重復(fù)背景

          創(chuàng)建重復(fù)的背景圖片


          在drawable目錄下創(chuàng)建一個(gè)repeat_bg.xml:  src是引用圖片的名稱

          1
          2
          3
          4
          5
          6
          7
          8
          1
          <?xml version="1.0" encoding="utf-8"?>
          2
          <bitmap xmlns:android="
          3
              android:src="@drawable/bg"
          4
              android:tileMode="repeat" />

          然后在布局的xml文件中可以這樣引用:

          1
          2
          3
          4
          5
          6
          7
          8
          1
          <LinearLayout android:layout_width="fill_parent"
          2
              android:layout_height="fill_parent"
          3
              android:background="@drawable/repeat_bg">
          4
          </LinearLayout>

          posted @ 2014-02-16 09:59 何云隆 閱讀(206) | 評(píng)論 (0)編輯 收藏

          SQL Server 里面的生成SQL腳本

          通常情況下,SQL Server里面的生成SQL腳本,只會(huì)包含數(shù)據(jù)庫(kù)及表的字段結(jié)構(gòu),而不會(huì)包含表的數(shù)據(jù),也就是SQL腳本里面只有Create database,Create table 這樣的語(yǔ)句,沒(méi)有insert into。
          因?yàn)镾QL Server并不包含這個(gè)功能,只能靠第三方的代碼了。
          以下存儲(chǔ)過(guò)程可以實(shí)現(xiàn):
          CREATE PROCEDURE dbo.UspOutputData
          @tablename sysname
          AS
          declare @column varchar(1000)
          declare @columndata varchar(1000)
          declare @sql varchar(4000)
          declare @xtype tinyint
          declare @name sysname
          declare @objectId int
          declare @objectname sysname
          declare @ident int
          set nocount on
          set @objectId=object_id(@tablename)
          if @objectId is null -- 判斷對(duì)象是否存在
          begin
          print 'The object not exists'
          return
          end
          set @objectname=rtrim(object_name(@objectId))
          if @objectname is null or charindex(@objectname,@tablename)=0 --此判斷不嚴(yán)密
          begin
          print 'object not in current database'
          return
          end
          if OBJECTPROPERTY(@objectId,'IsTable') < > 1 -- 判斷對(duì)象是否是table
          begin
          print 'The object is not table'
          return
          end
          select @ident=status&0x80 from syscolumns where id=@objectid and status&0x80=0x80
          if @ident is not null
          print 'SET IDENTITY_INSERT '+@TableName+' ON'
          declare syscolumns_cursor cursor
          for select c.name,c.xtype from syscolumns c where c.id=@objectid order by c.colid
          open syscolumns_cursor
          set @column=''
          set @columndata=''
          fetch next from syscolumns_cursor into @name,@xtype
          while @@fetch_status < >-1
          begin
          if @@fetch_status < >-2
          begin
          if @xtype not in(189,34,35,99,98) --timestamp不需處理,image,text,ntext,sql_variant 暫時(shí)不處理
          begin
          set @column=@column+case when len(@column)=0 then'' else ','end+@name
          set @columndata=@columndata+case when len(@columndata)=0 then '' else ','','','
          end
          +case when @xtype in(167,175) then '''''''''+'+@name+'+''''''''' --varchar,char
          when @xtype in(231,239) then '''N''''''+'+@name+'+''''''''' --nvarchar,nchar
          when @xtype=61 then '''''''''+convert(char(23),'+@name+',121)+''''''''' --datetime
          when @xtype=58 then '''''''''+convert(char(16),'+@name+',120)+''''''''' --smalldatetime
          when @xtype=36 then '''''''''+convert(char(36),'+@name+')+''''''''' --uniqueidentifier
          else @name end
          end
          end
          fetch next from syscolumns_cursor into @name,@xtype
          end
          close syscolumns_cursor
          deallocate syscolumns_cursor
          set @sql='set nocount on select ''insert '+@tablename+'('+@column+') values(''as ''--'','+@columndata+','')'' from '+@tablename
          print '--'+@sql
          exec(@sql)
          if @ident is not null
          print 'SET IDENTITY_INSERT '+@TableName+' OFF'
          GO
           
          使用方法:
          exec UspOutputData 你的表名
          選擇【執(zhí)行模式】為“以文本顯示結(jié)果”,然后將運(yùn)行后的結(jié)果存成.sql,加上用SQL Server生成的數(shù)據(jù)庫(kù)腳本就可以了。
          另外可以利用第三方工具,導(dǎo)出數(shù)據(jù)可以用powerbuilder。在database painter里面,用SQL選出,或者直接打開(kāi)表,點(diǎn)擊生成的list datawindow,然后在菜單file->save rows as->選擇SQL,那么生成的SQL語(yǔ)句就包括建表和insert數(shù)據(jù)的SQL了。

          轉(zhuǎn)載:http://blog.sina.com.cn/s/blog_49b531af0100i74v.html

          posted @ 2014-01-09 13:34 何云隆 閱讀(139) | 評(píng)論 (0)編輯 收藏

          CompoundButton

          Android 中文 API (29) —— CompoundButton


          前言

            本章內(nèi)容是android.widget.CompoundButton,翻譯來(lái)自德羅德,再次感謝德羅德 !期待你一起參與Android API 的中文翻譯,聯(lián)系我over140@gmail.com。 

           

            轉(zhuǎn)載

           

           正文

            一、結(jié)構(gòu)

              public abstract class CompoundButton extends Button implements Checkable

           

              java.lang.Object
                android.view.View
                  android.widget.TextView
                    android.widget.Button
                      android.widget.CompoundButton

           

            二、概述

              一個(gè)帶有選中/未選中狀態(tài)的按鈕。當(dāng)按鈕按下或點(diǎn)中時(shí)自動(dòng)改變狀態(tài)。

           

            三、公共方法

                   public boolean dispatchPopulateAccessibilityEvent (AccessibilityEvent event)

                   在子視圖的構(gòu)建時(shí)分派一個(gè)輔助事件。(譯者注:通過(guò)源碼可以看出,視圖構(gòu)建時(shí)設(shè)置其選中狀態(tài)。)

                             參數(shù)

                                      event       事件

                             返回值

                                      如果事件全部完成返回True

           

                   public boolean isChecked ()

                   (譯者注:是否選中)

           

                   public void onRestoreInstanceState (Parcelable state)

                   允許視圖重新應(yīng)用以前通過(guò)onSaveInstanceState()生成代表內(nèi)部的狀態(tài)。這個(gè)函數(shù)決不調(diào)用一個(gè)空的狀態(tài)。

                             參數(shù)

                                      state       返回以前調(diào)用onSaveInstanceState()保存下來(lái)的狀態(tài)。

           

                   public Parcelable onSaveInstanceState ()

                   允許視圖生成一個(gè)代表內(nèi)部的狀態(tài),以后可用于創(chuàng)建一個(gè)與之相同的新的實(shí)例。這種狀態(tài)應(yīng)該只包含非持久或以后不能夠重建的信息。例如,你決不存儲(chǔ)你當(dāng)前在屏幕上的位置,因?yàn)檫@會(huì)在視圖的層面上重新計(jì)算放置一個(gè)新的實(shí)例。

                   你可以存儲(chǔ)到這里的一些例子:一個(gè)文本框中當(dāng)前光標(biāo)的位置(但通常不是文字本身,文字通常保存在內(nèi)容提供者(content provider)或其他持久的儲(chǔ)存中),一個(gè)列表視圖中的當(dāng)前選中項(xiàng)。

                             返回值

                                      返回一個(gè)包含視圖當(dāng)前狀態(tài)的Parcelable對(duì)象,或沒(méi)有什么狀態(tài)保存時(shí)返回null。默認(rèn)實(shí)現(xiàn)返回null

           

                   public boolean performClick ()

                   如果視圖定義了OnClickListener監(jiān)聽(tīng)器,調(diào)用此方法來(lái)執(zhí)行。

                             返回值

                                      定義了的OnClickListener被調(diào)用返回True,否則返回False

           

                   public void setButtonDrawable (Drawable d)

                   給按鈕背景設(shè)置一個(gè)可繪制對(duì)象(如:圖像)

                             參數(shù)

                                      d      用作背景的可繪制對(duì)象(如:圖像)

           

                   public void setButtonDrawable (int resid)

                   通過(guò)資源Id給按鈕背景設(shè)置一個(gè)圖像

                             參數(shù)

                                      resid        作為背景圖像的資源id

           

                   public void setChecked (boolean checked)

                   改變按鈕的選中狀態(tài)

                            參數(shù)

                                      checked true選中,false非選中

           

                   public void setOnCheckedChangeListener (CompoundButton.OnCheckedChangeListener listener)

                   注冊(cè)一個(gè)在按鈕狀態(tài)發(fā)生改變時(shí)執(zhí)行的回調(diào)函數(shù)

                             參數(shù)

                                      listener  當(dāng)選中狀態(tài)改變時(shí)調(diào)用的函數(shù)

           

                   public void toggle ()

                   改變選中狀態(tài)為當(dāng)前狀態(tài)的逆狀態(tài)

           

            四、受保護(hù)方法

                   protected void drawableStateChanged ()

                   在視圖狀態(tài)的變化影響到所顯示可繪制的狀態(tài)時(shí)調(diào)用這個(gè)方法。

          確保在重載時(shí)中調(diào)用父類方法

           

                   protected int[] onCreateDrawableState (int extraSpace)

                   為當(dāng)前視圖生成新的可繪圖區(qū)狀態(tài)。這個(gè)方式當(dāng)緩存的圖像繪圖區(qū)狀態(tài)確定失效時(shí)通過(guò)視圖系統(tǒng)調(diào)用。你可以使用getDrawableState()方法重新取得當(dāng)前的狀態(tài)。

                             參數(shù)

                                      extraSpace      如果為非零,這是你應(yīng)該返回的數(shù)組在你可以存放你的狀態(tài)的額外條目的數(shù)量。

                             返回值

                                      返回一個(gè)記錄著視圖中當(dāng)前繪圖區(qū)狀態(tài)的數(shù)組

           

                   protected void onDraw (Canvas canvas)

                   實(shí)現(xiàn)你自己的繪制。

                             參數(shù)

                                      canvas    在畫(huà)布上繪制背景

           

                   protected boolean verifyDrawable (Drawable who)

                   如果你的視圖子類顯示他自己的可視化對(duì)象,他將要重寫(xiě)此方法并且為了顯示可繪制返回true。此操作允許進(jìn)行繪制時(shí)有動(dòng)畫(huà)效果。

            確認(rèn)當(dāng)重寫(xiě)從方法時(shí),需調(diào)用父類相應(yīng)方法。

                             參數(shù)

                                      who         需判斷的可繪制對(duì)象(Drawable)。如果是你要顯示的對(duì)象,返回True,否則返回調(diào)用父類的結(jié)果。

                             返回值

                                      boolean 如果可繪制對(duì)象(Drawable)已經(jīng)在視圖中顯示,返回True否則返回false。并且此處不允許使用動(dòng)畫(huà)。 

          posted @ 2013-12-20 22:43 何云隆 閱讀(185) | 評(píng)論 (0)編輯 收藏

          僅列出標(biāo)題
          共11頁(yè): 上一頁(yè) 1 2 3 4 5 6 7 8 9 下一頁(yè) Last 
          主站蜘蛛池模板: 凤阳县| 沾化县| 泽州县| 云安县| 祁东县| 合肥市| 泸水县| 滁州市| 沂南县| 伽师县| 延庆县| 忻城县| 遵义县| 当雄县| 安图县| 额尔古纳市| 收藏| 屯留县| 赤城县| 林甸县| 武强县| 读书| 基隆市| 牟定县| 三都| 阳东县| 岳池县| 浦城县| 新昌县| 贵阳市| 平遥县| 汶川县| 彰化县| 北安市| 天峨县| 中宁县| 玉屏| 南和县| 兴义市| 霍城县| 五寨县|