2013-08-06 2 views
0

저는 작업 표시 줄 탭 탐색 기능을 사용하여 activtiy을 빌드하는 방법을 알고 있습니다. 하지만 나는 키보드와 같은 단편 탭 호스트 (예를 들어 탭으로 구성된 세 가지 다른 종류의 스마일)를 오버레이하는 방법을 알아야합니다. 모든 코드 또는 자습서 - 링크 매우 감사하겠습니다! 사전에키보드를 탭 조각으로 바꿉니다.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="#f6f6f8"> 


<ListView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/listViewChat" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" 
     android:layout_alignTop="@+id/LinearLayout1" android:layout_above="@+id/LinearLayout1" 
     android:divider="@null" android:dividerHeight="0dp" android:clickable="false"/> 

<LinearLayout 
     android:id="@+id/LinearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="vertical" 
     android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" 
     android:background="@drawable/riwa_in" 
     > 

code removed here is a custom view (copyright issue) 

<LinearLayout 

     android:layout_width="match_parent" 
     android:layout_height="50dp" 

     android:orientation="horizontal" 
     > 



    <ImageButton 
      android:id="@+id/addContentChat" 
      android:layout_width="45dp" 
      android:layout_height="match_parent" 
      android:background="@null" 
      android:longClickable="true" 
      android:padding="8dp" 
      android:src="@drawable/emo_mod_im_happy" /> 

    <EditText 
      android:id="@+id/mesText" 
      android:layout_width="0dp" 
      android:layout_height="37dp" 
      android:layout_marginTop="7dp" 
      android:layout_weight="0.57" 
      android:autoLink="all" 
      android:hint="@string/messageHint" 
      android:inputType="textMultiLine" 
      android:linksClickable="true" 
      android:maxHeight="50dp" 
      android:maxLines="4" 
      android:paddingLeft="8dp" 
      android:paddingRight="5dp" 
      android:textColor="#000000" 
      android:textSize="15sp" 
      android:textStyle="normal" 

      android:typeface="sans" > 

     <requestFocus /> 
    </EditText> 

    <ImageButton 
      android:id="@+id/sendButton" 
      android:layout_width="40dp" 
      android:layout_height="40dp" 
      android:longClickable="true" 
      android:src="@drawable/ic_send_holo_light" android:layout_gravity="center_vertical" 
      android:background="@null" android:focusable="false" android:scaleType="center" 
      /> 


</LinearLayout> 


</LinearLayout> 

감사합니다!

답변

2

왜 화면의 맨 아래에 조각을 배치하고 오버레이를 만들면 좋을까요? 레이아웃을 게시하면보다 정확한 답을 줄 수 있습니다. 그러나 예를 들어 이런 식으로 뭔가를 시도 :

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

    // Put everything else which is supposed to be in your layout here 

    <Fragment 
     android:id="@+id/frmBottomOverlay" 
     android:name="com.example.fragment.YourBottomOverlayFragment" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:visible="gone" 
     android:layout_alignParentBottom="true" /> 
</RelativeLayout> 

을 다음 방금 프로그래밍 방식 View.VISIBLE에 조각의 가시성을 설정해야합니다 하단에있는 조각을 표시하려는 경우.

당신이 바닥에 조각이 시도 표시 할 때 키보드를 숨기려면 : 그것은 다른 모든 오버레이 경우

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); 
imm.hideSoftInputFromWindow(myEditText.getWindowToken(), 0); 
+0

, 또한 키보드를 오버레이는 무엇입니까? 나는 내 questoion을 편집했습니다. 이제 xml을 포함합니다. –

+0

아니요, 조각의 가시성을 View.VISIBLE로 설정할 때 키보드를 숨길 수 있습니다. 내 대답을 편집하여 키보드를 숨기는 방법을 설명합니다. –

+0

thx 나는 키보드를 숨기는 방법을 이미 알고있다. 그 조각을 최후 레벨로 내 구조의 최상위 레벨에 두어야합니까? –

관련 문제