2016-09-23 1 views
1

일부 맞춤보기로 공통 목록보기를 작성하고 있습니다. 그것에 대해 특별한 것은 없습니다.일부 목록보기 항목에서 Android 신비한 여백

하지만 내 은하계 s7에서 이것을 실행하면 사용자 정의 항목보기의 중앙에 신비한 수평 간격이 만들어집니다.

다음은 listView baseAdapter의 getView()에서 반환 될 사용자 정의 항목보기의 추상적 인 버전입니다. 이러한 setLayoutParams로 (새로운 LinearLayout.LayoutParams (..., ...))를 코드 추가

public class CustomView extends LinearLayout { 
public CustomView(Context context) { 
    super(context); 
    LayoutInflater inflater = (LayoutInflater) context 
      .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    inflater.inflate(R.layout.cell_dutch, this, true); 

    } 
} 

; 아무 효과가 없다.

레이아웃

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

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="right" 
    android:orientation="horizontal"> 


    <LinearLayout 
     android:id="@+id/linearLayoutTime" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:layout_marginBottom="3dp" 
     android:gravity="bottom" 
     android:orientation="vertical"> 

     <TextView 
      android:id="@+id/textViewUnRead" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right" 
      android:layout_marginBottom="5dp" 
      android:text="" 

      android:textColor="@color/colorUnread" 
      android:textSize="9dp" /> 

     <TextView 
      android:id="@+id/tvDate" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:layout_marginBottom="5dp" 
      android:text="PM 3:11" 
      android:textColor="@color/color_chatcrey" 
      android:textSize="9dp" /> 
    </LinearLayout> 


    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="8dp" 
     android:orientation="vertical"> 

     <LinearLayout 
       android:background="@drawable/img_chat_bubble_white_you_02_android" 
      android:id="@+id/llBubble" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_margin="8dp" 
       android:background="@drawable/..." 
       android:id="@+id/imageView" /> 

      <ImageView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/..." /> 

      <!-- RED BOX --> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal" 
       android:padding="10dp"> 

       <TextView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="TOTAL" 
        android:textSize="10dp" /> 

       <View 
        android:layout_width="0dp" 
        android:layout_height="1dp" 
        android:layout_weight="1" /> 

       <TextView 
        android:id="@+id/textViewTotalPoint" 
        android:layout_width="0dp" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:layout_weight="1" 
        android:gravity="right" 
        android:textColor="#000000" 
        android:textSize="8dp" 
        android:textStyle="bold" /> 

       <ImageView 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_marginLeft="5dp" 
        android:background="@drawable/..." /> 
      </LinearLayout> 


     </LinearLayout> 

     <!-- PURPLE BOX --> 
     <ImageButton 
      android:id="@+id/imageButtonSnsShare" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="@drawable/..." /> 


    </LinearLayout> 
</LinearLayout> 
그것은 이런 결과

다음과 같다; enter image description here

위의 스크린 샷에서 빨간색 상자와 자주색 단추 사이에는 간격이 없어야합니다. 사실, 안드로이드 스튜디오 UI 편집기에서, 나는 어떤 간격도 보지 않지만, 단지 런타임에 나타납니다.

그러나 이것을 시험하기 위해 만든 다른 프로젝트에서는 아래 이미지처럼 잘 보입니다.

enter image description here

는 두 프로젝트 사이 목록보기 항목으로 사용자 정의보기를 보여주는에 논리의 차이 없을 것 같다. 왜 이런 일이 일어나야합니까?

+0

나는 지난 몇 년 동안 삼성 기기와 관련된 수많은 문제를 보아 왔습니다. 앱 테마를 명시 적으로 설정하지 않은 경우 명시 적으로 설정하십시오. 삼성 기기의 기본 설정은 약간 우연히 구현됩니다. – 323go

+0

'ListView'에서 하나의 뷰 유형을 가지고 있다고 가정합니다. RED와 PURPLE에 속한 부분을 레이아웃 파일에 표시 할 수 있습니까? – LightYearsBehind

+0

아니요, 사실, 내보기에는 5 가지 이상의보기 유형이 있습니다. 위의 코드는 화면의 결과가 해당 소스에서 기원되어 있기 때문에 축소 된 버전입니다. RED와 보라색보기를 나타 내기 위해 샘플 코드 안에 캡션을 추가하겠습니다. – March3April4

답변

0

해결책을 찾았습니다. 그것은 실제로 특별한 무엇에 대해서도 wans't하지 않습니다. 이 문제를 일으킨 것은 9 패치의 채팅 거품에 관한 것입니다.

관련 문제