2012-03-29 2 views

답변

1

view.getIndex() 또는 view.isOnFront 같은입니다. 그래서 첫 번째 바닥 Z- 인덱스, 마지막 최고 Z- 인덱스

+1

순서 변경 때문에. 필요한 것은 view.getIndex() 또는 view.isOnFront()와 같은 것입니다. – znat

+4

indexOfChild를 사용하십시오. –

+0

@stefanbachert 이것은 유익하고 수용 가능한 대답이어야합니다. 감사. –

2

입니다 시도 그들은 조작하고이

RelativeLayout re=(RelativeLayout) findViewById(R.id.MyRelative); 
    int[] zIndexTab=new int[re.getChildCount()]; 
    for (int i = 0; i < re.getChildCount(); i++) { 
     zIndexTab[i]=re.getChildAt(i).getId(); // zIndexTab[0] will have the Id of the first child in this Layout etc.. 
     // So the first index corresponding to the first view. 
     // The smaller View index will be under the biggest View Index 
     // for example my first View is a button it's index is 0 , the second view is a spinner it's index is 1 
     // so the spinner will be on the front of the button etc.. 
    } 
+0

액세스해야하는 두 개의보기가 다른 레이아웃의 일부인 경우 어떻게됩니까 ?? – Taranmeet

관련 문제