2014-11-06 3 views
0

다음 레이아웃을 살펴보십시오. 이 레이아웃은 TableView에서 사용되며 각 행에 적용됩니다. 문제는 투명성이 적용될 때 각 tablerow의 버튼이 tableviewcell의 위쪽 절반에서만 클릭 할 수있는 이유입니다. 투명도가 없으면 단추가 정확한 공간을 채 웁니다. Android의 TableView 셀에 투명 버튼 사용

어떤 도움

<?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" 
    android:paddingBottom="10dp" 
    android:paddingTop="10dp" > 

    <ImageButton 
     android:id="@+id/btnSelect" 
     android:layout_width="40dp" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_centerVertical="true" 
     android:background="@color/white" 
     android:contentDescription="Geselecteerde rekening" 
     android:src="@drawable/checkbox_akkoord_uit" /> 

    <ImageView 
     android:id="@+id/imgPhoto" 
     android:layout_width="40dp" 
     android:layout_height="40dp" 
     android:layout_alignBottom="@+id/btnSelect" 
     android:layout_marginLeft="4dp" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@+id/btnSelect" 
     android:scaleType="fitCenter" 
     android:src="@drawable/icon_foto" /> 

    <ImageView 
     android:id="@+id/imgPencil" 
     android:layout_width="40dp" 
     android:layout_height="40dp" 
     android:layout_alignBottom="@+id/btnSelect" 
     android:layout_marginLeft="4dp" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@+id/btnSelect" 
     android:src="@drawable/potlood" /> 

    <ImageView 
     android:id="@+id/ivDrag" 
     android:layout_width="20dp" 
     android:layout_height="20dp" 
     android:layout_alignParentRight="true" 
     android:layout_marginRight="@dimen/activity_horizontal_margin" 
     android:layout_centerVertical="true" 
     android:src="@drawable/settings" /> 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="8dip" 
     android:layout_toLeftOf="@+id/ivDrag" 
     android:layout_toRightOf="@+id/imgPhoto" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/txtDescription" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:ellipsize="end" 
      android:maxLines="1" 
      android:text="Medium Text Medium Text" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textColor="@color/green" 
      android:textSize="@dimen/text_size_1" /> 

     <TextView 
      android:id="@+id/txtProductname" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:ellipsize="end" 
      android:maxLines="1" 
      android:text="Small Text" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textColor="@color/green" 
      android:textSize="@dimen/text_size_2" /> 

     <TextView 
      android:id="@+id/txtAccountnumber" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:ellipsize="end" 
      android:maxLines="1" 
      android:text="Medium Text" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textColor="@color/green" 
      android:textSize="@dimen/text_size_3" /> 
    </LinearLayout> 

<Button 
    android:id="@+id/btnModify" 
    android:background="@android:color/transparent" 
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent" 
    android:layout_toRightOf="@+id/btnSelect" 
    android:layout_toLeftOf="@+id/ivDrag" /> 
이 크게 감사합니다! 감사합니다, 라울

답변

0

버튼이 최소 높이가 필요합니다. 따라서 변경된 XML 정의는 다음과 같을 수 있습니다.

<Button 
    android:id="@+id/btnModify" 
    android:background="@android:color/transparent" 
    android:minHeight="40dp" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@+id/btnSelect" 
    android:layout_toLeftOf="@+id/ivDrag" /> 

이것은 나를 위해 일했습니다!

감사합니다.