今天对仿微信应用的发现,以及我的进行简单的介绍,先铺上我画好的界面两张图片如下:
发现栏的实现,主要是对红点位置的掌握,以及每个控件之间的位置掌握,图片素材在 http://www.iconfont.cn/ 搜索关键字查找,具体实现过程,前两天的博客有具体解析,需要注意的是我们要在 总布局上加上ScrollView, 在加入我们需要使用的布局,这样的目的是使我们的每块布局,在超出屏幕高度时能够通过滑动的方式进行展现。今天的具体代码如下:
发现 模块:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EBEBEB">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="20dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/feiend"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="朋友圈"
android:layout_marginLeft="70dp" />
<ImageView
android:id="@+id/lala"
android:layout_width="40dp"
android:layout_height="40dp"
android:src="@drawable/picturela"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
/>
<ImageView
android:layout_width="10dp"
android:layout_height="10dp"
android:src="@drawable/red_point"
android:layout_alignRight="@+id/lala"
android:layout_marginRight="-4dp"
android:layout_alignTop="@+id/lala"
android:layout_marginTop="-4dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="91dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/saoyisao"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="扫一扫"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="142dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/yaoyiyao"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="摇一摇"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="212dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/fujinderen"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="附近的人"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="282dp"
android:id="@+id/relativeLayout">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/shop"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="购物"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="333dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/game"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="游戏"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="403dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/xiaochengxu"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="小程序"
android:layout_marginLeft="70dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
我的 模块:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#EBEBEB">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:background="#ffffff"
android:layout_marginTop="20dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/usepicture"
android:layout_marginLeft="20dp"
android:id="@+id/userimage"/>
<RelativeLayout
android:layout_marginLeft="20dp"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_toRightOf="@+id/userimage"
android:layout_centerVertical="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="原来我是实力派"
android:id="@+id/useid"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="微信号:lds18341211674"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<ImageView
android:id="@+id/lala"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/erweima"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:layout_marginRight="30dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="122dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/qianbao"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="钱包"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="192dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/shouchang"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="收藏"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="243dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/xiangce"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="相册"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="294dp"
>
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/kabao"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="卡包"
android:layout_marginLeft="70dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="345dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/biaoqing"
android:layout_marginLeft="20dp"
android:id="@+id/imageView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="表情"
android:layout_marginLeft="18dp"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/imageView"
android:layout_toEndOf="@+id/imageView"
android:layout_marginStart="18dp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#ffffff"
android:layout_marginTop="416dp">
<ImageView
android:layout_centerVertical="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/shezhi"
android:layout_marginLeft="20dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="设置"
android:layout_marginLeft="70dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>