Android 导航栏实现(仿网易新闻)

扬帆一号 2011-10-27 11:09:31
请教大家,如何实现类似网易新闻客户端中,最上面“头条,体育,娱乐,财经,科技”等的导航。
最好有代码。
...全文
2237 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
doveqian 2013-10-25
  • 打赏
  • 举报
回复
HorizontalScrollView 肯定用这个的 我自己现在就用这个
NeXT___ 2013-10-24
  • 打赏
  • 举报
回复
引用 16 楼 jiangqq781931404 的回复:
引用 15 楼 kingideayou 的回复:
[quote=引用 13 楼 lovexjyong 的回复:] 用Fragment
那之后怎么在fragment中创建lisiView呢?
难道fragment你没有用过? [/quote]不好意思,真是新手,问题已经解决了
NeXT___ 2013-10-24
  • 打赏
  • 举报
回复
引用 16 楼 jiangqq781931404 的回复:
引用 15 楼 kingideayou 的回复:
[quote=引用 13 楼 lovexjyong 的回复:] 用Fragment
那之后怎么在fragment中创建lisiView呢?
难道fragment你没有用过? [/quote]我新手,想请教一下。ListFragment添加listView之后,页面刷新要怎么办呢? 如果继承ListFragment,那么 FragmentManager fm; FragmentTransaction ft; fm = getFragmentManager(); ft = fm.beginTransaction(); 在这句代码,replace就会报错,要怎么改呢? ft.replace(R.id.content, new Fragment_news()); ft.commit(); 新手求教。
江清清 2013-10-24
  • 打赏
  • 举报
回复
引用 15 楼 kingideayou 的回复:
引用 13 楼 lovexjyong 的回复:
用Fragment
那之后怎么在fragment中创建lisiView呢?
难道fragment你没有用过?
NeXT___ 2013-10-24
  • 打赏
  • 举报
回复
引用 13 楼 lovexjyong 的回复:
用Fragment
那之后怎么在fragment中创建lisiView呢?
a-white-lie 2012-01-18
  • 打赏
  • 举报
回复
do you know "Fragment"?
a-white-lie 2012-01-18
  • 打赏
  • 举报
回复
用Fragment
小裴同学 2012-01-16
  • 打赏
  • 举报
回复
我了个去,我敢打赌这绝对是textview或者imageview,加了动画效果和美化就是了。你不信反编译看看。
大掌教 2012-01-16
  • 打赏
  • 举报
回复
这个事基础了吧
blueduan1985 2012-01-16
  • 打赏
  • 举报
回复
楼主可以尝试把那个程序反编译一下,看看他的布局是如何实现的
coder2600 2012-01-15
  • 打赏
  • 举报
回复
导航: 在一个FrameLayout中有一个ImageView,通过设置这个ImageView的位置即可实现 (省去美工做很多图片) FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)imageView.getLayoutParams();
lp.leftMargin = 20?;
imageView.setLayoutParams(lp);
imageView.invalidate();

选项卡: 看这位同学的http://www.cnblogs.com/xiaoguang123/archive/2011/09/26/2191825.html 有代码下载
petshop4 2011-11-14
  • 打赏
  • 举报
回复


<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout android:orientation="vertical" android:id="@id/main"
android:background="#ffecedee" android:layout_width="fill_parent"
android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<include android:id="@id/top_main_bottom" android:layout_width="fill_parent"
android:layout_height="wrap_content" layout="\@layout/top_bottom" />
<TabHost android:id="@id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_below="@id/top_main_bottom">
<FrameLayout android:id="@android:id/tabcontent"
android:paddingBottom="42.0px" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<!--tab_news-->
<LinearLayout android:orientation="vertical" android:id="@id/tab_news"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:id="@id/column_navi"
android:background="@drawable/top_column_bg" android:visibility="gone"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<ImageButton android:id="@id/column_to_left"
android:background="#00000000" android:visibility="visible"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="5.0px" android:src="@drawable/arr_left"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
<ImageButton android:id="@id/column_to_right"
android:background="#00000000" android:visibility="visible"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="5.0px" android:src="@drawable/arr_right"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
<HorizontalScrollView android:id="@id/column_scrollview"
android:scrollbars="none" android:fadingEdge="vertical"
android:layout_width="fill_parent" android:layout_height="35.0px"
android:layout_toLeftOf="@id/column_to_right"
android:layout_toRightOf="@id/column_to_left">
<FrameLayout android:layout_gravity="center_vertical"
android:paddingLeft="5.0px" android:paddingTop="3.0px"
android:paddingRight="5.0px" android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:id="@id/column_slide_bar"
android:layout_width="49.0px" android:layout_height="29.0px" />
<LinearLayout android:layout_gravity="center_vertical"
android:id="@id/column_title_layout" android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</FrameLayout>
</HorizontalScrollView>
</RelativeLayout>
<FrameLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView android:id="@id/top_weight_bg_id"
android:background="@drawable/top_weight_bg" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ListView android:id="@id/itemlist" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:listSelector="@drawable/listview_selector"
android:cacheColorHint="#00000000" android:divider="@drawable/list_divider_line" />
</FrameLayout>
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/tab_topic"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ListView android:id="@id/topic_list" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:listSelector="@drawable/listview_selector"
android:cacheColorHint="#00000000" android:divider="@drawable/list_divider_line" />
</LinearLayout>
<LinearLayout android:gravity="center"
android:orientation="vertical" android:id="@id/tab_images"
android:background="@drawable/pictures_bg" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridView android:id="@id/photosetgridview"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_marginLeft="5.0px" android:layout_marginRight="5.0px"
android:horizontalSpacing="5.0px" android:verticalSpacing="5.0px"
android:numColumns="2" />
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/tab_notes"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<include android:layout_width="fill_parent"
android:layout_height="fill_parent" layout="\@layout/comments" />
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/tab_vote"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout android:orientation="vertical"
android:id="@id/vote_image_text" android:layout_width="fill_parent"
android:layout_height="360.0px" xmlns:android="http://schemas.android.com/apk/res/android" />
<ImageView android:background="@drawable/top_weight_bg"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_alignTop="@id/vote_image_text" />
</RelativeLayout>
</LinearLayout>
<include android:layout_gravity="center"
android:layout_width="fill_parent" android:layout_height="fill_parent"
layout="\@layout/loadingbar" />
</FrameLayout>
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:background="@drawable/tab_bg" android:layout_width="fill_parent"
android:layout_height="42.0px" android:layout_alignParentBottom="true" />
<ImageView android:id="@id/tab_front_bg"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/tab_front_bg" android:layout_alignLeft="@android:id/tabs"
android:layout_alignBottom="@android:id/tabs" />
<ImageView android:id="@id/tab_bg_bg" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:src="@drawable/bottom_weight_bg"
android:layout_above="@android:id/tabs" />
</RelativeLayout>
</TabHost>
</LinearLayout>
petshop4 2011-11-14
  • 打赏
  • 举报
回复
代码里面是用的HorizontalScrollView
SasONsoft 2011-10-28
  • 打赏
  • 举报
回复
帮顶了~~~
zhangjingtao6100 2011-10-28
  • 打赏
  • 举报
回复
你完全可以写一排button 美工一修饰就看起来像你上面的效果了
而下面就是一个tabhost 加载各种布局就哈了
扬帆一号 2011-10-28
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 vyphn 的回复:]
textview+tabhost
[/Quote]
你好,如果上面的导航栏用tabhost ,那下面红色框中的功能也有tabhost.一个布局文件中能有两个tabhost吗?
QQ:1520074566,可以QQ交流.
knxw0001 2011-10-28
  • 打赏
  • 举报
回复
嗯,不好看。
ccaaiigg 2011-10-28
  • 打赏
  • 举报
回复
太难看了
Vyphn 2011-10-27
  • 打赏
  • 举报
回复
textview+tabhost

80,362

社区成员

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

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