项目中有个需求类似于野兽派的首页效果,我这里把他叫做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 k8s部署jupyterlab,jupyterlab保存不了文件
- ¥15 ubuntu虚拟机打包apk错误
- ¥199 rust编程架构设计的方案 有偿
- ¥15 回答4f系统的像差计算
- ¥15 java如何提取出pdf里的文字?
- ¥100 求三轴之间相互配合画圆以及直线的算法
- ¥100 c语言,请帮蒟蒻写一个题的范例作参考
- ¥15 名为“Product”的列已属于此 DataTable
- ¥15 安卓adb backup备份应用数据失败
- ¥15 eclipse运行项目时遇到的问题