Button(link)
android:clickable='bool' : set to false to disable the button
android:id="@+id/theID" : unique ID for use in Java code
android:onClick="function" : function to call in activity when clicked(must be public, void, and take a View arg)
android:text="text" : text to put in the button
TextView
android:id="@+id/theID" : unique ID for use in Java code
android:text="string" : text to display
ScrollView
<ScrollView> 스크롤 뷰에 포함할 것들 </ScrollView>
Sizing and Positioning
과거 : Absolute positioning - 프로그래머가 정확한 픽셀이나 크기를 지정해놓음, 기기마다 화면이 다르므로 적절한 방법은 아니었음.
ViewGroup(위젯 또는 view를 포함함) as layout (XML로 표현)
ViewGroup superclass represents containers of views
- layouts are dexcribed in XML and mirrored in Java code
- Android provides several pre-existing layout managers; you can define your own custome layouts if needed.
- layouts can be nested to achieve combinations of features.
In the Java code and XML:
- an Activity is a ViewGroup
- various Layout classes are also ViewGroups
- widgets can be added to ViewGroup, which will then manage that widgets position/size behavior.
XML
a language for decribing hierarchical text data.
- uses tags that consist of elements and attributes. Tags can be nested.
- Some tags are opened and closed; others self-close.
Changing layouts
: go to the Text view for your layout XML file.
: change open/close tags to new layout type, ex- LinearyLayout
: now go back to Design view and add widgets.
LinearLayout
: lays out widgets/views in a single line
: orientation of horizontal or vertical
: items do not wrap if they reach edge of screen!
Gravity
: alignment direction that widgets are pulled.
: top, bottom, center
Widget box model
: content - size of widget itself
: padding
- artificial increase to widget size outside of content
- extra space inside widget
- set padding to adjust all sides; paddingTop, Bottom, Left, Right for one side
- usually set to specific values like 10dp (some widgets have a default value ~16dp)
: border - outside padding, a line around edge of widget
: margin - invisible separation from neighboring widgets
'공부 > Android' 카테고리의 다른 글
[Android] Activity (0) | 2017.03.26 |
---|---|
[Android] Intent, Activity 전환 (0) | 2017.03.26 |
[Android]layout_gravity, gravity의 차이 (+ layout_weight) (0) | 2017.03.23 |
[Android] Lec 01 (0) | 2017.03.23 |
[Android] 용어정리 (0) | 2017.03.23 |