2013-11-21 4 views
2

작동하지 나는 최근에 내 ListView를 구현 검색 기능이 제대로 작동이 중지되었습니다 내가 왜 ...의 ListView 레이아웃 변경

사용자가 검색 활동 아이콘을 선택

, 검색 상자를 알아낼 수 없습니다 것으로 나타났습니다 상단에 나타나고 그에 따라 ListView가 조정됩니다.

내가 겪고있는 문제는 "검색"상자가 이제는 더 이상 ListView를 "푸시"한다는 것입니다. ...보기를 보여 ...

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:animateLayoutChanges="true" > 

<FrameLayout 
    android:id="@+id/search_frame" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:visibility="gone" > 

    <!-- Editext for Search --> 

    <EditText 
     android:id="@+id/inputSearch" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:inputType="textVisiblePassword" /> 

    <Button 
     android:id="@+id/btnClearText" 
     android:layout_width="wrap_content" 
     android:layout_height="30dp" 
     android:layout_gravity="right" 
     android:background="@android:color/transparent" 
     android:onClick="clearSearch" 
     android:paddingRight="10dp" 
     android:text="X" 
     android:textColor="#B3B3B3" /> 
</FrameLayout> 

<!-- List View --> 
<ListView 
    android:id="@+id/list_view" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:overScrollMode="never" /> 

<!-- 
Navigarion Drawer (Thought this might be casing the problem, but is still broken when removed) 

<ListView 
    android:id="@+id/left_drawer" 
    android:layout_width="240dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:background="#f9f9f9" 
    android:choiceMode="singleChoice" 
    android:divider="#919191" 
    android:dividerHeight="0dp" /> 
--> 

</android.support.v4.widget.DrawerLayout> 

그리고 간단한 자바 코드 여기

은 ...

enter image description here

예입니다 그리고 여기 레이아웃 XML입니다

/** 
* Show/Hide the search box 
*/ 
private void showSearch() 
{ 
    try 
    { 
     //in the instance there are not items...a crash will occur when searching 
     if(items.length > 0) 
     { 
      if(searchFrame.getVisibility() == View.VISIBLE)//hide the search bar 
      { 
       searchFrame.setVisibility(View.GONE); 
       resetList(); 
      } 
      else//show the search bar 
      { 
       searchFrame.setVisibility(View.VISIBLE); 
      } 
     } 
    } 
    catch(Exception e) 
    { 
     Library.errorHandler("showSearch", e); 
    } 
} 

어떤 아이디어 ..?

감사

편집 : 나는 지금이 android.support.v4.widget.DrawerLayout입니다 발견했다. LinearLayout 사용할 경우 잘 작동합니다.

하지만 지금은 내가 확실하지

+0

임에?를있는 LinearLayout과 DrawerLayout을 모두 사용하여 가야하지만, 당신이 얼마나 내비게이션 창 :(

을 사용할 수 없습니다 문제를 일으키는 framelayout을 사용하여 relativelayout을 아래 목록보기로 바꾸십시오. edittext – user2652394

+0

@ user2652394 아쉽게도 FrameLayout을 사용하여 작동합니다. S –

답변

0

시도는이 코드

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:orientation="vertical" > 

    <EditText 
     android:id="@+id/inputSearch" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:inputType="textVisiblePassword" /> 
<Button 
    android:id="@+id/btnClearText" 
    android:layout_width="46dp" 
    android:layout_height="30dp" 
    android:layout_gravity="end" 
    android:background="@android:color/transparent" 
    android:onClick="clearSearch" 
    android:paddingRight="1dp" 
    android:text="X" 
    android:textColor="#B3B3B3" /> 

<ListView 
     android:id="@+id/list_view" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:overScrollMode="never" /> 

</LinearLayout> 
+1

응답을 보내 주셔서 감사합니다. 그러나 전자가 있습니다. 게시물을 dited, 지금은 LinearLayout에서 작동합니다하지만 난 DrawerLayout뿐만 아니라 같은 문제가 포함될 경우 –