자마린(Xamarin)

(자마린기초강좌)Xamarin.Android 기초 강좌, Built-In List Item Layouts(내장 리스트아이템 레…

자마린을 자바라~

Xamarin.Android 기초 강좌

 

Built-In List Item Layouts(내장 리스트아이템 레이아웃)

n  내장된 리스트 아이템들을 위한 Layouts 다음과 같은 것들이 있다.

n  Android.Resource.Layout.ActivityListItem

1 ImageView (Android.Resource.Id.Icon)

1TextView(Android.Resource.Id.Text1)

 

 

 

n  Android.Resource.Layout.SimpleListItem1

1TextView(Android.Resource.Id.Text1

 

using System; 

using Android.App; 

using Android.OS; 

using Android.Widget;

 

namespace HelloWorld 

{

    [Activity (Label = " MainActivity")]

    public class MainActivity : ListActivity

    {

        protected override void OnCreate (Bundle savedInstanceState)

        {

            base.OnCreate (savedInstanceState);

 

            var names = new [] { "Fluffy", "Muffy", "Tuffy" };

 

            this.ListAdapter = new ArrayAdapter (

                                this, //Context, typically the Activity

                                Android.Resource.Layout.SimpleListItem1, //The layout. How the data will be presented

                                names //The enumerable data

                            );

        }

    }

}

 

 

n  Android.Resource.Layout.SimpleListItem2

1TextView/Title (Android.Resource.Id.Text1)

1TextView/Subtitle(Android.Resource.Id.Text2)

 

 

n  Android.Resource.Layout.SimpleListItemActivated1

1 TextView (Android.Resource.Id.Text1)

 

*  multiple or single ChoiceMode를 설정해야 한다.

this.ListView.ChoiceMode=Multiple

 

 

 

n  Android.Resource.Layout.SimpleListItemActivated2

1 TextView (Android.Resource.Id.Text1)

1 TextView/Subtitle (Android.Resource.Id.Text2)

 

* multiple or single ChoiceMode를 설정해야 한다.

this.ListView.ChoiceMode = ChoiceMode.Multiple;

 

 

eMode.Multiple;

n  Android.Resource.Layout.SimpleListItemChecked

1 TextView (Android.Resource.Id.Text1)

 

* Set choice mode to multiple or single

this.ListView.ChoiceMode = ChoiceMode.Multiple;

 

 

 

n  Android.Resource.Layout.SimpleListItemSingleChoice

1 TextView (Android.Resource.Id.Text1)

 

* Set choice mode to single

this.ListView.ChoiceMode = ChoiceMode.Single;

 

 

 

n  Android.Resource.Layout.SimpleListItemMultipleChoice

1 TextView (Android.Resource.Id.Text1)

 

* Set choice mode to multiple 

 

n  Android.Resource.Layout.TestListItem

1TextViewAndroid.Resource.Id.Text1)

 

 

 

n  Android.Resource.Layout.TwoLineListItem

1 TextView/Title (Android.Resource.Id.Text1)

1     TextView/Subtitle (Android.Resource.Id.Text2)

 

 

 

 

Comments