–4 About View

來源:互聯網
上載者:User

today tutorial is about view.

first is base conception of view.

second is in the activity obtain view object.

third is setting view attributes.

fourth is for view set listener.

ok,the beginning of  the next.

ONE:

what is view.view is a visible view.contain it's subclass textview,imageview,edittext,button...A View occupies a rectangular area on the screen and is responsible for drawing and event handling.

View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.).

two:

in that way we how in activity obtain view object?there are two kinds of circumstances.frist is view object in xml.second is view in java instance.if you is frist need usr findviewByid interface,or you is second  new View() when this you already finded
view object.

Three:

first function in xml setting,second in java file setting.Generally in xml setting common attribute.in java file setting special attribute.

example:in textview set width and height but the contents of textview need dynamic change,so our need in java file set contents of textview(maybe write in the listener

function).of cause, this is a simple examle.

Four:

in order to view set listener.the view(textview edittext imageview button...) maybe be used user operation.example long click,short click,roll,edit so need set listener.

how to in order view binding listener?

Is divided into four steps.

1,obtain represents the control object.

2,define a class implement listener interface.

3,create listener object.

4,in order view binding listener object.

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.