0
  • 你只是要实现点击的时候背景变化?


    你学习一下RecyclerView的课程不就可以了么?


    包括点击事件什么都有。


    课程介绍


    https://www.sunofbeach.net/c/1179080584903847936


    下载地址,去找一下吧,关联功能没做好。


    https://www.sunofbeach.net/course-download



    1153952789488054272  评论     打赏       拉大锯
    • <?xml version="1.0" encoding="utf-8"?>
      <LinearLayout     xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical"     android:layout_width="match_parent"     android:layout_height="match_parent">     <Button          android:layout_width="wrap_content"         android:layout_height="wrap_content"/>     <LinearLayout         android:orientation="horizontal"         android:layout_width="wrap_content"         android:layout_height="wrap_content"     >         <Button              android:layout_width="wrap_content"             android:layout_height="wrap_content"/>         <Button              android:layout_width="wrap_content"             android:layout_height="wrap_content"/>     </LinearLayout>
      </LinearLayout>
      

      像这种,不在一个ListView里的,没有规律的界面,能实现点击一个按钮改变它的颜色吗,

      不是给每个按钮添加监听

      1254955771674759168  评论     打赏       三,三
      • 拉大锯  回复 @三,三
        直接设置按钮的背景为selector的drawable。这些东西,怎么不好好学习基础呢?就这个知识点吧。在RecyclerView里有讲到,在基础课程的p1里的计算器布局案例里有讲到。
        拉大锯 2021-05-13 11:31   回复 1153952789488054272
      • 拉大锯  回复 @拉大锯
        https://www.sunofbeach.net/c/1179075373221081088,课程下载去下载界面,或者去B站看,计算器布局那个例子,计算器不也是按了背景会变么?
        拉大锯 2021-05-13 11:32   回复 1153952789488054272
    相关问题
    幻影~ · 提问
    2024-04-13 20:13 10 2
    幻影~ · 找工作
    2024-04-07 10:44 16 2
    幻影~ · 问题
    2024-03-31 17:20 7 2
    TONYGFX · AOSP
    2024-03-28 17:11 4 2