Please take a look at the following layout. This layout is used in a TableView and is applied in each row. The question is why the button in each tablerow is only clickable in the upper half of the tableviewcell when transparency is applied. Without transparency the button fills up the correct amount of space.
<?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" />
Any help is greatly appreciated! Regards, Raoul
Turns out that the Button needs a minimum height. So the altered XML definition could be:
<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" />
This worked for me!
Regards, Raoul.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.