2013-10-23 4 views
0

나는 ListView가 각 항목의 레이아웃으로 다음과 같은 한 :listview 항목이 처음에 비활성화되는 이유는 무엇입니까?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:orientation="horizontal" 
android:layout_height="match_parent" > 


<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="TextView" /> 


<Button 
    android:id="@+id/button1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="Button" /> 

</LinearLayout> 

하지만 때마다 나는이 받고 있어요 :

enter image description here

당신이 볼 수 있듯이, 두 버튼도를 TextViews가 비활성화되어 있으므로 (모양을 확인하십시오). ListView의 각 개별 항목은 클릭 할 때 액션을 취합니다 (OnItemClickListener()를 정의했습니다). 유일한 문제는 (지금까지) 버튼과 텍스트 뷰의 모습입니다. main_layout.xml은 다음과 같습니다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:orientation="vertical" 
android:layout_height="match_parent" > 

<TextView 
    android:id="@+id/textView1" 
    android:layout_width="wrap_content" 
    android:layout_weight="1" 
    android:layout_height="0dp" 
    android:hint="Text empty" 
    android:text="TextView" /> 

<ListView 
    android:id="@+id/listView1" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="9" > 
</ListView> 

</LinearLayout> 
+1

질문을 편집하고 ListView XML 레이아웃과 자바 클래스를 추가 할 수 있습니까? –

+0

해제로 무엇을 의미합니까? listView 항목의 onItemclick이 트리거링하지 않는다고 말하고 싶습니까? –

+0

내 질문을 편집했습니다. "장애인"이란 말은 당신이보고있는 것을 의미했습니다. 버튼의 "모양"은 내가 의미하는 바를 말해줍니다. –

답변

0

잘 작동합니다. 에뮬레이터가 열리면 화면을 사용해야하므로 화면이 비활성화됩니다. 유휴 상태로두면이 컨트롤이 숨겨집니다. 에뮬레이터의 화면 안쪽을 아무 곳이나 클릭하면 그것은 제어 할 것입니다.

+0

그렇지 않습니다. 첫 번째보기 (TextView)를 살펴보십시오. 활성화되어 있습니다! –

+0

xml 레이아웃에 목록보기를 추가 할 수 있습니까? 내가 코드를 확인 했어. 괜찮아요. 질문에 편집 –

+0

내가 그랬어. 이제 뭐? –

관련 문제