gpt4 book ai didi

android - LinearLayout 未被点击

转载 作者:行者123 更新时间:2023-11-29 19:13:28 25 4
gpt4 key购买 nike

我尝试了很多,但是,我的 Linearlayout 没有被点击:

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
android:id="@+id/ll_top_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="false"
android:orientation="vertical">

<LinearLayout
android:focusableInTouchMode="true"
android:clickable="true"
android:id="@+id/ll_Promos"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/vv_divider4"
android:layout_marginTop="@dimen/dimen_5"
android:orientation="horizontal"
android:padding="@dimen/dimen_10">

<ImageView
android:id="@+id/iv_restaurant_promo"
android:layout_width="@dimen/dimen_25"
android:layout_height="@dimen/dimen_25"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/dimen_5"
android:layout_marginRight="@dimen/dimen_5"
android:src="@drawable/promos" />

<com.app.thelist.view.CustomTextView
android:id="@+id/txt_restaurant_promo"
style="@style/RegularFont"
android:layout_gravity="center"
android:layout_marginRight="@dimen/dimen_5"
android:layout_weight="1"
android:padding="@dimen/dimen_5"
android:text="@string/promo"
android:textColor="@color/txt_sub_title"
android:textSize="@dimen/sp_15" />

<ImageView
android:id="@+id/iv_restaurant_promo_next"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/dimen_5"
android:src="@mipmap/app_icon"
android:visibility="gone" />

</LinearLayout>
</LinearLayout>
</ScrollView>

上面是我的 xml 文件,我已经将我的 LinearLayout 命名为:ll_Promos 没有被点击。我已经在 java 文件中实现了我的 onClick() :

ll_promos = (LinearLayout) findViewById(R.id.ll_Promos);
ll_promos.setOnClickListener(this);
case R.id.ll_Promos:
Intent intentProm = new Intent(Activity1.this, Activity2.class);
startActivity(intentProm);
break;

最佳答案

删除

  android:focusableInTouchMode="false" // Problem starts from here

Set whether this view can receive focus while in touch mode. Setting this to true will also ensure that this view is focusable.

并添加

android:focusableInTouchMode="true"
android:clickable="true"

关于android - LinearLayout 未被点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44405874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com