Center an imageview in half of parentview without using LinearLayout
<p>The way my layout is designed at the moment is that I have a <code>LinearLayout</code> having a <code>width="match_parent"</code>. This view has two ImageViews as its children, which take up half of the LinearLayouts width using <code>weight="1"</code></p>

<p>The problem is that this way, onClicks are registered on transparent portions of the card, because the View is stretched.</p>

<p>Edit: I should have mentioned, that these circles are only supposed to represent image files and not circle-shapes filled with a solid color.</p>

<p>My current code:</p>

<pre><code>&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"&gt;

    &lt;ImageView

        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" /&gt;

    &lt;ImageView

        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" /&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>The red portion indicates touch areas</p>

<p><img src="https://i.imgur.com/3VeVb6B.jpg" alt="x" title="image"></p>

<p>what I want is something like the following while keeping the ratios: <img src="https://imgur.com/KQ74iKl.jpg" alt="this" title="image2"></p>

<p>I know that I could simply try to nest each ImageView in a RelativeLayout like so:</p>

<pre><code>&lt;LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"&gt;

    &lt;RelativeLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"&gt;

        &lt;ImageView
            android:layout_centerInParent="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" /&gt;
    &lt;/RelativeLayout&gt;

    &lt;RelativeLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1" /&gt;

    &lt;RelativeLayout
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1"&gt;

        &lt;ImageView
            android:layout_centerInParent="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" /&gt;
    &lt;/RelativeLayout&gt;


&lt;/LinearLayout&gt;
</code></pre>

<p>but nesting like this is pretty horrible form</p>