Android 高仿百度贴吧发帖页面

本次项目是做一个论坛,我仿照了一下百度贴吧的发帖效果,实现界面如下所示,将源码发出来分享一下。

核心主要是实现两个地方:

1、点击输入框之后,页面浮动,将下面的上传图片布局给顶上来。

2、输入帖子内容部分需要全屏显示;

针对这两个部分,这里分别交代一下:

1)为了实现点击输入框之后,页面浮动,将下面的上传图片布局给顶上来。这里将内容部分嵌套一个ScrollView滚动模块,这样就可以被顶起。

2)为了达到全屏显示帖子内容。这里需要将ScrollView中加入如下设置:

android:fillViewport="true"

使内部支持android:layout_height="match_parent"

由于这是项目中的一部分,没有单独做Demo了,这就不放出来了~核心源码全部在下面。

       

publish_note.xml

<?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" >

    <!-- 加载标题栏 -->
    <include
        android:id="@+id/publish_title_bar"
        layout="@drawable/publish_title_bar" />

    <LinearLayout
        android:id="@+id/publish_note_bottom_bar"
	    android:layout_width="match_parent"
	    android:layout_height="wrap_content"
	    android:layout_alignParentBottom="true"
	    android:orientation="horizontal">
		<!-- 加载底部栏 -->
	    <include
	        layout="@drawable/publish_note_bottom_bar" />
	</LinearLayout>

    <!-- 帖子标题 -->
    <EditText
        android:id="@+id/et_note_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/publish_title_bar"
        android:hint="@string/tip_note_title"/>
    <ScrollView
        android:id="@+id/sv_note_contain"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:layout_above="@id/publish_note_bottom_bar"
        android:layout_below="@id/et_note_title">
		<!-- 帖子内容 -->
		<EditText
        	android:id="@+id/et_note_contain"
	        android:layout_width="match_parent"
	        android:layout_height="match_parent"
	        android:gravity="top"
	        android:inputType="textMultiLine"
	        android:singleLine="false"
	        android:hint=""/>

	</ScrollView>

</RelativeLayout>

publish_title_bar.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="48dp"
    android:background="@color/index_title">

    <!-- 回退 -->
     <ImageView
	    android:id="@+id/im_back"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:layout_centerVertical="true"
	    android:layout_alignParentLeft="true"
	    android:contentDescription="@string/desc_indexpic"
	    android:src="@drawable/browser_back" />
     <!-- 发表主题 -->
     <TextView
        android:id="@+id/tv_publish"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="@string/publish_topic"
        android:textColor="@color/black"
        android:textSize="18pt"/>
     <!-- 占位 -->
     <TextView
	    android:id="@+id/tv_null"
	    android:layout_width="10dp"
	    android:layout_height="wrap_content"
	    android:layout_alignParentRight="true"
	    android:layout_centerVertical="true"
	    android:text=""/>
     <!-- 发帖 -->
     <TextView
	    android:id="@+id/tv_publish_note"
	    android:layout_width="wrap_content"
	    android:layout_height="wrap_content"
	    android:layout_toLeftOf="@id/tv_null"
	    android:layout_centerVertical="true"
	    android:textColor="@color/black"
	    android:textSize="18pt"
	    android:text="@string/publish_note"/>

</RelativeLayout>

publish_bottom_bar.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	    android:layout_width="match_parent"
	    android:layout_height="match_parent"
	    android:orientation="horizontal">
	    <ImageView
		    android:id="@+id/im_pictrue"
		    android:layout_width="wrap_content"
		    android:layout_height="wrap_content"
		    android:layout_centerVertical="true"
		    android:layout_alignParentLeft="true"
		    android:contentDescription="@string/desc_indexpic"
		    android:src="@drawable/btn_pb_add_n" />
</LinearLayout>
时间: 2024-08-27 02:17:47

Android 高仿百度贴吧发帖页面的相关文章

(android高仿系列)今日头条 --新闻阅读器 (三) 完结 、总结 篇

从写第一篇今日头条高仿系列开始,到现在已经过去了1个多月了,其实大体都做好了,就是迟迟没有放出来,因为我觉得,做这个东西也是有个过程的,我想把这个模仿中一步一步学习的过程,按照自己的思路写下来,在根据碰到的知识点和问题,并且罗列出这些东西的知识点和使用方法.如果你单纯的把做好的一个DEMO拿去改改用用,那样,你永远不知道里面用到的内容是涉及到什么知识点,用什么方法实现,那样就没有多少提升价值而言了. 近期都是在通过开发文档把以前的一些东西重新过一遍,看好多网友都催促想要新版本的,那我就在这里先把

Android 高仿 QQ5.0 侧滑菜单效果 自定义控件来袭【学习鸿洋_视频博客笔记总结】

学习鸿洋博客:http://blog.csdn.net/lmj623565791/article/details/39257409 学习鸿洋视频:慕课网视频 看看Android 高仿 QQ5.0 侧滑菜单效果 自定义控件实现效果: 技术上,继承HorizontalScrollView 加上自定义ViewGroup来实现: 1.onMeasure:决定内部View(子View)的宽和高,以及自己的宽和高 2.onLayout:决定子View的放置位置 3.onTouchEvent[监听动作] 自定

Android高仿QQ消息滑动删除(附源码)

大家都应该使用过QQ吧,他的消息中可以滑动删除功能,我觉得比较有意思,所以模仿写了一个,并且修改了其滑动算法.我先贴几个简单示范图吧 其实主要用的是算法以及对ListView的把控. 一下是适配器的类 ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

Android 高仿 频道管理----网易、今日头条、腾讯视频 (可以拖动的GridView)附源码DEMO

距离上次发布(android高仿系列)今日头条 --新闻阅读器 (二) 相关的内容已经半个月了,最近利用空闲时间,把今日头条客户端完善了下.完善的功能一个一个全部实现后,就放整个源码.开发的进度就是按照一个一个功能的思路走的,所以开发一个小的功能,如果有用,就写一个专门的博客以便有人用到独立的功能可以方便使用. 这次实现的功能是很多新闻阅读器(网易,今日头条,360新闻等)以及腾讯视频等里面都会出现的频道管理功能. 下面先上这次实现功能的效果图:(注:这个效果图没有拖拽的时候移动动画,DEMO里

高仿百度传课iOS版,版本号2.4.1.2

高仿百度传课iOS版,版本号:2.4.1.2 运行环境:xcode6.3  ios8.3 (再往上系统没有测试) github源码链接:https://github.com/lookingstars/chuanke 转载请注明出处,不可用于商业用途及不合法用途. 如果你觉得不错,欢迎  star  哦 主要内容:课程首页,课程分类,搜索(语音输入搜索,文字输入搜索),课程列表,微信分享.新浪分享,课程详情,课程评价,视频在线播放,学校详情,学校所有课程 1.课程推荐首页: 2.课程分类 3.搜索

【IOS】高仿百度传课

高仿百度传课 高仿百度传课iOS版,版本号:2.4.1.2 运行环境:xcode6.3 ios8.3 (再往上系统没有测试) github源码链接:https://github.com/lookingstars/chuanke 转载请注明出处,不可用于商业用途及不合法用途. 如果你觉得不错,欢迎 star 哦 主要内容:课程首页,课程分类,搜索(语音输入搜索,文字输入搜索),课程列表,微信分享.新浪分享,课程详情,课程评价,视频在线播放,学校详情,学校所有课程. 注意:工程采用cocoapods

【案例】高仿百度注册页

注意点: 1.正则表达式的匹配 2.密码强度规则的设置 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>高仿百度注册页</title> <style> *{ margin:0; padding:0; } form{ width:800px; height: 300px; border:1px

Android 高仿微信实时聊天 基于百度云推送

转载请标明出处:http://blog.csdn.net/lmj623565791/article/details/38799363 ,本文出自:[张鸿洋的博客] 一直在仿微信界面,今天终于有幸利用百度云推送仿一仿微信聊天了~~~ 首先特别感谢:weidi1989分享的Android之基于百度云推送IM ,大家可以直接下载:省了很多事哈,本例中也使用了weidi的部分代码,凡是@author way的就是weidi1989的代码~~ 1.效果图 核心功能也就上面的两张图了~~~我拿着手机和模拟器

Android高仿微信头像裁剪

最近公司的APP很多用户反应无法上传头像,于是打算修改原来头像裁剪的代码.参考微信.QQ.唱吧头像裁剪的操作,决定就仿微信头像裁剪来上传用户头像,在Android大神鸿洋的一篇高仿微信头像的博客(博客地址结尾会贴出来)的基础上加了一些代码,加的代码主要增加如下的功能: 1.增加对大图的处理,缩放到我们裁剪框的大小. 2.裁剪后的图片保存到临时文件里,把临时文件的路径返回到需要处理的界面,因为在三星S4传byte数组返回数据时会闪退,传路径则正常. 3.对有些系统返回旋转过的图片进行处理. 这个功