android按比例布局如何实现

zhongshansubor 2014-09-03 11:01:19
如下android布局如何实现:

具体要求:
1.左上区域会放android.support.v4.view.ViewPager控件用来放置图标,可以左右滑动翻页。
2.右上区域会会放置一列图标按钮。
3.下侧区域会放置一行图标按钮,可以左右翻动翻页,每个按钮点击对应左上区域的一页内容。
...全文
439 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
passself 2014-09-03
  • 打赏
  • 举报
回复
两个linearlayout 就可以了,水平再垂直 layout_weight 分配比例,当然也可以用table
哎,真难 2014-09-03
  • 打赏
  • 举报
回复
layout_weight可以去研究下
zhongshansubor 2014-09-03
  • 打赏
  • 举报
回复
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="4" android:background="#ff0000" tools:context="com.example.viewpagertest.MainActivity$PlaceholderFragment" > <LinearLayout android:id="@+id/linearLayoutUp" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="3" android:background="#00ff00" android:orientation="horizontal" > <!-- 上左侧图标 --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="6" > <android.support.v4.view.ViewPager android:id="@+id/viewPagerUpLeft" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> <!-- 上右侧按钮 --> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:orientation="vertical" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/button_jysoft" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/button_jysoft" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/button_jysoft" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/button_jysoft" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:background="@drawable/button_jysoft" /> </LinearLayout> </LinearLayout> <!-- 下侧导航 --> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:background="#0000ff" android:orientation="horizontal" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="sssss" /> <android.support.v4.view.ViewPager android:id="@+id/viewPagerBottom" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout>
  • 打赏
  • 举报
回复
layout_weight
savior120 2014-09-03
  • 打赏
  • 举报
回复
请用linearlayout ,水平再垂直 layout_weight 值分配比例
fireyou 2014-09-03
  • 打赏
  • 举报
回复
layout_weight 调试一下
红袖满楼招 2014-09-03
  • 打赏
  • 举报
回复
layout_weight轻松实现啊

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧