项目中有个需求类似于野兽派的首页效果,我这里把他叫做A层和B层,A层是一张图片,
B层我是用的一个ListView+header的效果实现的,header布局主要是为了留出空白的
位置让用户可以看见A层的效果,并可以点击操作A层,但是添加了ListView的header
的监听事件阻挡了A层的监听,请问这样该怎么处理呢。
Android仿野兽派首页效果
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答
- 哥们OnlyRead 2017-05-18 02:50关注
不知道你为什么上面怎么留的Listview的head,你试试用下面的方式。
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"><ImageButton android:id="@+id/ib_a" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@mipmap/ic_launcher"/> <ListView android:id="@+id/lv_b" android:layout_width="match_parent" android:layout_height="300dip" android:layout_alignParentBottom="true" android:background="@android:color/white"> </ListView>
public class MainActivity3 extends AppCompatActivity {
private ImageButton ib_a;
private ListView lv_b;@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout); init(); } protected void init() { ib_a = (ImageButton) findViewById(R.id.ib_a); lv_b = (ListView) findViewById(R.id.lv_b); ib_a.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v){ Toast.makeText(getApplicationContext(),"点击下部的A",Toast.LENGTH_SHORT).show(); } }); String [] data = {"1","2","3"}; ArrayAdapter<String> adapter = new ArrayAdapter(getApplicationContext(),android.R.layout.simple_expandable_list_item_1,data); lv_b.setAdapter(adapter); }
}
解决 无用评论 打赏 举报
悬赏问题
- ¥15 nginx中的CORS策略应该如何配置
- ¥30 信号与系统实验:采样定理分析
- ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
- ¥20 Vite 打包的 Vue3 组件库,图标无法显示
- ¥15 php 同步电商平台多个店铺增量订单和订单状态
- ¥15 关于logstash转发日志时发生的部分内容丢失问题
- ¥17 pro*C预编译“闪回查询”报错SCN不能识别
- ¥15 微信会员卡接入微信支付商户号收款
- ¥15 如何获取烟草零售终端数据
- ¥15 数学建模招标中位数问题