How to make the image easier to click?

I placed an image in each ListView on the right side. In the xml layout, I set its width and length to 20dip, a little, and I find it difficult to click on it, because the image is only 20 * 20 dip in size, I hope that its length does not change, and its height fills the parent, I tried:

    android:layout_width="20dip"
    android:layout_height="fill_parent"

but that will not work.

Below is my xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/item"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" 
android:padding="6dip"
android:background="#FFFFFF">

<ImageView android:id="@+id/avatar" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginRight="6dip"
    android:src="@drawable/default_happy_face" />

<RelativeLayout 
    android:orientation="vertical"
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:layout_toRightOf="@id/avatar"
            android:layout_toLeftOf="@+id/optionImg">

   <!-- some stuff unrelated-->

</RelativeLayout>

<!-- v Pay attention here v -->
<ImageView android:id="@+id/optionImg"
    android:layout_width="20dip"
    android:layout_height="fill_parent"
    android:layout_marginLeft="15dip"
    android:paddingLeft="5dip"
    android:adjustViewBounds="true"
    android:background="@drawable/option_normal"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"/>
</RelativeLayout>

If you closely monitor the Twitter client for Android, you will find that the image on the right side of each ListView element is quite easy to click (even if you do not click on the image, but, for example, say, for example, above the button). I want to know how to do this.

twitter image http://www.freeimagehosting.net/uploads/889d10c435.png

Is anyone any help?

+3
2

, ? .

+1

EDIT: , . , ( ) , .

ListView ( ListView Android). styles.xml, - ( ).

android:background="@drawable/bg"
android:cacheColorHint="#00000000"

, ( Android). .

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.Transparent" parent="android:Theme">
  <item name="android:windowIsTranslucent">true</item>
  <item name="android:windowBackground">@android:color/transparent</item>
  <item name="android:windowContentOverlay">@null</item>
  <item name="android:windowNoTitle">true</item>
  <item name="android:windowIsFloating">true</item>
  <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>

, / Android (Android: /). :

Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_4444);
buffer.eraseColor(Color.TRANSPARENT);
0

Source: https://habr.com/ru/post/1759347/


All Articles