我在水平滾動視圖中添加了線性佈局,並在佈局中添加了一些文本視圖。是否有可能在此佈局中顯示可見的孩子。HorizontalScrollView得到可見的孩子
這個代碼讓所有的孩子,但我想只得到可見(當前顯示的)孩子:
final HorizontalScrollView scroll = (HorizontalScrollView)findViewById(R.id.horizontalScrollView1);
LinearLayout linearLayout = ((LinearLayout)scroll.findViewById(R.id.linearLayout1));
int chilrenNum = linearLayout.getChildCount();
你的意思是'可見的孩子是setVisibilty(View.VISIBLE)'嗎?或者你的意思是「看得見」? – 2013-03-27 09:22:19
我的意思是看得見。 – user2106897 2013-03-27 09:47:58