HorizontalScrollView 案例布局
2018-03-06 13:06
309 查看
布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!--横向菜单 只能有一个子孩子 -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/hsv">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:id="@+id/lin_menu">
</LinearLayout>
</HorizontalScrollView>
<!--viewPager实现页面的滑动-->
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/vp"
android:layout_below="@id/hsv"></android.support.v4.view.ViewPager>
</RelativeLayout>
子布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_title"/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/img1"
android:layout_below="@id/tv_title"/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lv"></ListView>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!--横向菜单 只能有一个子孩子 -->
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/hsv">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:orientation="horizontal"
android:id="@+id/lin_menu">
</LinearLayout>
</HorizontalScrollView>
<!--viewPager实现页面的滑动-->
<android.support.v4.view.ViewPager
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/vp"
android:layout_below="@id/hsv"></android.support.v4.view.ViewPager>
</RelativeLayout>
子布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_title"/>
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/img1"
android:layout_below="@id/tv_title"/>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/lv"></ListView>
</RelativeLayout>
相关文章推荐
- Android线性布局LinearLayout,及盒模型,weight权值,ScrollView和HorizontalScrollView【内容溢出(内容太多,高度/宽度大于能显示的最大高度/宽度)】
- Horizontalscrollview里添加一个布局,该布局里在添加一个自定义的View,为什么View里用Canvas画图无法显示?
- 用HorizontalScrollView布局实现类似Gallery效果
- Horizontalscrollview里添加一个布局,该布局里在添加一个自定义的View,为什么View里用Canvas画图无法显示?
- [转]HorizontalScrollView介绍--支持水平滚动的android布局容器
- Horizontalscrollview里添加一个布局,该布局里在添加一个自定义的View,为什么View里用Canvas画图无法显示?
- Horizontalscrollview里添加一个布局,该布局里在添加一个自定义的View,为什么View里用Canvas画图无法显示?
- 教你使用HorizontalScrollView和ListView打造左右和上下都可以滑动的列表布局
- HorizontalScrollView将子View布局居中
- Android 中的用HorizontalScrollView布局实现类似Gallery效果
- 原生 HorizontalScrollView 和自定义 HorizontalScrollView 案例
- listview的子布局如果有HorizontalScrollView、CheckBox 、button,可能会导致onListItemClick点击事件失效。
- 布局动画Android ScrollView HorizontalScrollView 实现全方向(上下左右)反弹效果
- HorizontalScrollView不显示滚动条,布局完全填充的方法
- Android 继承framelayout,实现ScrollView 和 HorizontalScrollView 的效果
- 解决HorizontalScrollView 里面组件 设置为match_parent 无效的问题。
- 使用HorizontalScrollView实现最简单的侧滑菜单
- Android 用HorizontalScrollView实现ListView的Item滑动删除 ,滑动错乱 冲突
- android 使用HorizontalScrollView 实现标题带动内容左右切屏
- Android - HorizontalScrollView(ViewPager) within ScrollView Touch Handling