我在水平LinearLayout
中有兩個TextView
,它包含在另一個可點擊的容器中 - android:clickable="true"
。我不希望點擊通過LinearLayout
的孩子,但他們正在通過其中一個孩子。點擊次數通過LinearLayout中的一個兄弟,但不通過其他
這兩個TextView
孩子幾乎相同,除了他們的身份證,體重和重力屬性;然而,我試圖設置除了ID之外的所有東西都是平等的,但點擊仍然通過其中一個兄弟姐妹。
以編程方式,沒有發生一個不會發生在另一個。這是最奇怪的事情。
下面是LinearLayout
代碼:
*的點擊都在流血通過@id/sibling_2
<LinearLayout
android:id="@+id/linear_layout_container"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/maring_left"
android:layout_marginRight="@dimen/maring_right"
android:layout_marginTop="@dimen/top_margin"
android:layout_weight="1"
android:background="@drawable/bg">
<TextView
android:id="@+id/sibling_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="30"
android:padding="@dimen/padding"
android:gravity="center_horizontal"
android:textSize="@dimen/text_size"
android:hint="Score"/>
<!--the text view that clicks are bleeding through-->
<TextView
android:id="@+id/sibling_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="@dimen/padding"
android:gravity="center"
android:textSize="@dimen/text_size"
android:hint="100%"/>
</LinearLayout>
顯示,如果 – VenomVendor
@VenomVendor不知道你看到的更新您的Java代碼,但我刪除它,因爲我長大的那個是不正確的點。如果你確實看到它,'interim_container'仍然註冊點擊,即使我不清空它的背景 –
@VenomVendor,並且只要java代碼去除了,除了通過它們的id找到視圖,然後設置它們的文本 –