안드로이드란 무엇입니까?R.layout.simple_list_item_1"?
저는 안드로이드 개발을 배우기 시작했고 책에서 토돌리스트의 예를 따르고 있습니다.
// Create the array list of to do items
final ArrayList<String> todoItems = new ArrayList<String>();
// Create the array adapter to bind the array to the listView
final ArrayAdapter<String> aa;
aa = new ArrayAdapter<String>( this,
android.R.layout.simple_list_item_1,
todoItems
);
myListView.setAdapter(aa);
이 코드, 특히 이 줄은 정확히 이해할 수 없습니다.
android.R.layout.simple_list_item_1
Zakaria는 자체 XML 레이아웃 중 하나가 아니라 Android OS의 일부인 내장 XML 레이아웃 문서에 대한 참조입니다.
다음은 사용할 수 있는 추가 레이아웃 목록입니다. http://developer.android.com/reference/android/R.layout.html
(업데이트 된 링크 감사 @Estel: https://github.com/android/platform_frameworks_base/tree/master/core/res/res/layout )
레이아웃의 코드를 실제로 볼 수 있습니다.
이것은 안드로이드 OS의 일부분입니다.정의된 XML 파일의 실제 버전입니다.
simple_list_item_1:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/listItemFirstLineStyle"
android:paddingTop="2dip"
android:paddingBottom="3dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
simple_list_item_2:
<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingTop="2dip"
android:paddingBottom="2dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/listItemFirstLineStyle"/>
<TextView android:id="@android:id/text2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@android:id/text1"
style="?android:attr/listItemSecondLineStyle" />
</TwoLineListItem>
위 답변: kcoppock 및 Joril에 의해 답변됨
여기로 이동 : https://github.com/android/platform_frameworks_base/tree/master/core/res/res/layout
원하는 레이아웃 파일을 마우스 오른쪽 단추로 클릭한 다음 '다른 이름으로 저장'을 선택하고 어딘가에 저장한 다음 안드로이드 프로젝트의 'layout' 폴더에 복사합니다(일식).
레이아웃이 어떻게 생겼는지 보실 수 있습니다 :)
파이팅...
클랩 안드로이드가 언급한 바와 같이.R.layout.simple_list_item_1은 Android OS의 일부인 내장 XML 레이아웃 문서에 대한 참조입니다."
모든 레이아웃은 sdk\platforms\android-xx\data\res\layout에 위치합니다.
레이아웃의 XML을 보려면:
이클립스:안드로이드를 입력하기만 하면 됩니다.R.layout.simple_list_item_1 코드 어딘가에 있는 Ctrl을 누른 상태에서 simple_list_item_1 위를 맴돌다가 나타나는 드롭다운에서 "Open declaration in layout/simple_list_item_1.xml"을 선택합니다.XML의 내용을 안내해 드립니다.
Android Studio:프로젝트 창 -> 외부 라이브러리 -> Android X Platform -> res -> 레이아웃을 선택하면 사용 가능한 레이아웃 목록이 나타납니다.
android.R.layout.simple_list_item_1
, 이것은 당신의 res/layout 폴더에 있는 행 레이아웃 파일이며, 당신의 행에 해당하는 설계를 포함합니다.listview
. 이제 배열 목록 항목을 행 레이아웃에 바인딩합니다.mylistview.setadapter(aa)
;
외부 링크로 이동할 필요 없이 필요한 모든 것이 컴퓨터에 이미 저장되어 있습니다.
Android\android-sdk\platforms\android-x\data\res\layout.
모든 안드로이드 레이아웃의 소스코드는 여기에 있습니다.
Arvand당:
이클립스:안드로이드를 입력하기만 하면 됩니다.R.layout.simple_list_item_1 코드 어딘가에 있는 Ctrl을 누른 채 simple_list_item_1 위를 맴돌다가 나타나는 드롭다운에서 레이아웃/simple_list_item_1.xml에서 선언 열기를 선택합니다.XML의 내용을 안내해 드립니다.
여기서 편집기의 simple_list_item_1.xml 탭을 가리키면 파일이 C:\Data\applications\에 위치한 것을 볼 수 있습니다.Android\android-sdk\platforms\android-19\data\res\layout\simple_list_item_1.xml(또는 설치 시 동등한 위치).
언급URL : https://stackoverflow.com/questions/3663745/what-is-android-r-layout-simple-list-item-1
'programing' 카테고리의 다른 글
cURL 명령줄을 사용한 POST XML 파일 (0) | 2023.09.10 |
---|---|
UI뷰 쉐이크 애니메이션 (0) | 2023.09.10 |
XElement 또는 LINQ와 함께 XPath를 사용하는 방법은 무엇입니까? (0) | 2023.09.10 |
MariaDB와 트리거는 트리거된 테이블에서 작동합니다. (0) | 2023.09.10 |
이 빌드에는 사용되지 않는 Gradle 기능이 사용되어 Gradle 5.0과 호환되지 않습니다. (0) | 2023.09.10 |