안 드 로 이 드 응용 프로그램 개발 (6) 창 레이아웃
4046 단어 android
일반적으로 eclipse 의 코드 알림 기능 Alt + / 를 사용 하여 뒤에 추가 할 속성 값 을 표시 할 수 있 습 니 다.
우선 선형 레이아웃 스타일 을 살 펴 보 겠 습 니 다: LinearLayout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- , , -->
<!--
android:id ~~~~~~~~~~~~~ ID,
android:text ~~~~~~~~~~~~~ , string.xml string
android:grivity ~~~~~~~~~~~~~
android:textSize ~~~~~~~~~~~~~
android:background ~~~~~~~~~~~~~ , RGB
android:layout_width ~~~~~~~~~~~~~
android:layout_height ~~~~~~~~~~~~~
android:padding* ~~~~~~~~~~~~~
android:sigleLine ~~~~~~~~~~~~~ , , ...
-->
<TextView
android:id="@+id/firstText"
android:text="first Line"
android:gravity="center_vertical"
android:textSize="18pt"
android:background="#aa0000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="30dip"
android:paddingTop="20dip"
android:paddingBottom="10dip"
android:layout_weight="1"
android:singleLine="true"/>
<TextView
android:id="@+id/secondText"
android:text="second Line"
android:gravity="center_vertical"
android:textSize="18pt"
android:background="#00aa00"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dip"
android:paddingRight="30dip"
android:paddingTop="20dip"
android:paddingBottom="10dip"
android:layout_weight="2"
android:singleLine="true"/>
<Button
android:id="@+id/myButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
/>
</LinearLayout>
표 레이아웃 다시 보기: TableLayout
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="0" >
<!-- -->
<!-- -->
<TableRow>
<!-- -->
<TextView
android:text="@string/row1_column1"
android:background="#aa0000"
android:padding="3dip" />
<TextView
android:text="@string/row1_column2"
android:background="#00aa00"
android:padding="3dip" />
<TextView
android:text="@string/row1_column3"
android:background="#0000aa"
android:padding="3dip" />
</TableRow>
<!-- -->
<TableRow>
<!-- -->
<TextView
android:text="@string/row2_column1"
android:background="#00aa00"
android:padding="3dip" />
<TextView
android:text="@string/row2_column2"
android:background="#0000aa"
android:padding="3dip" />
</TableRow>
</TableLayout>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Kotlin의 기초 - 2부지난 글에서는 Kotlin이 무엇인지, Kotlin의 특징, Kotlin에서 변수 및 데이터 유형을 선언하는 방법과 같은 Kotlin의 기본 개념에 대해 배웠습니다. 유형 변환은 데이터 변수의 한 유형을 다른 데이터...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.