开发者

Accessing child elements, using parent defined in xml, android

开发者 https://www.devze.com 2023-01-20 12:31 出处:网络
<ViewFlipper开发者_如何学Python android:id=@+id/flipper > <ListView android:id=@+id/xyz />
<ViewFlipper开发者_如何学Python android:id=@+id/flipper >
    <ListView android:id=@+id/xyz />
    <ListView android:id=@+id/pqr />
    <ListView android:id=@+id/abc />
</ViewFlipper>

flipper=(ViewFlipper)findViewById(R.id.flipper);

   Can I access the id of child elements of flipper(xyz,pqr,abc) ? no. of child elements of flipper ?


Can I access the id of child elements of flipper(xyz,pqr,abc) ?

Yes, you can. For example as this:

flipper.getChildAt(index).getId()

no. of child elements of flipper ?

If you mean count of children then:

flipper.getChildCount()

0

精彩评论

暂无评论...
验证码 换一张
取 消