Layout also is view. You can create layout in the code and create view in
the layout resource. Then add view to layout. You can find view by
findViewById in layout.
在 2011-12-11 上午8:19,"Duygu Kahraman" 写道:
> Yeah you are right but for example if i added 5 view in the same
> layout.How must call
TextView valueTV = new TextView(this);
valueTV.setText("hallo hallo");
valueTV.setId(5);
valueTV.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
--
You received this message because you are subscribed to the Google
Grou
Merhaba Duygu,
ID'ye ihtiyacın olduğunu zannetmiyorum. XML'den yapsaydın, view'lara
erişmek istediğin zaman id'leri biliyor olacaktın. ID'leri bilmek ile
yarattığın objelere referansları bilmek arasında nasıl bir fark var
ki, yada fark var mı? Sıralı id vermek ile yarattığın objeleri mesela
bir Ar
you can do setid(any no) this will be your id
it is used to dynamically assign id to a view or a viewgroup
On Dec 11, 3:44 pm, Duygu Kahraman wrote:
> Selam Ali;
>
> Asıl sormak istediğim şu;mesela TextView tv=new TextView(this); diye bir
> view yarattım.Eğer xmlde yaratmış olsaydım id sini de o
Selam Ali;
Asıl sormak istediğim şu;mesela TextView tv=new TextView(this); diye bir
view yarattım.Eğer xmlde yaratmış olsaydım id sini de orada set edip
çağırabilecektim kodun içinden.Yada R dosyasında bir referans oluşturmuş
olacaktı.Ama program içinde yarattığımda R içinde tvye ait birşey
yok.S
Yazdığın kodun içinden view objelerini yaratınca, findViewById()
fonksiyonunu çağırmana gerek yok. Yarattığın objelere referanslar
elinde var zaten. Referansları saklayıp sonra kullanabilirsin. View
objelerini XML'den tanımlasaydın, findViewById() sana aynı
referansları döndürecekti.
-
On Sat, Dec 10, 2011 at 7:18 PM, Duygu Kahraman
wrote:
> Yeah you are right but for example if i added 5 view in the same layout.How
> must call i?How can i understand difference.
>
> I am not using FindViewById(); because i am not assigning anyhing.I think
> android can assign default id.Can it?
Yeah you are right but for example if i added 5 view in the same layout.How
must call i?How can i understand difference.
I am not using FindViewById(); because i am not assigning anyhing.I think
android can assign default id.Can it?
11 Aralık 2011 02:06 tarihinde lbendlin yazdı:
> what do you n
what do you need the id for? You are already programmatically creating the
view, so you hold the reference.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubsc
9 matches
Mail list logo