自定义View仿TabHost的实现(二)

简介: activity_1.xml如下: activity_2.xml如下:   activity_3.

activity_1.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"
    >
    
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Activity 1"
        android:textSize="50sp"
    />
      <cn.com.BottomMenuView
        android:layout_width="fill_parent"
        android:layout_height="70dip"
        android:layout_alignParentBottom="true"
     />
</RelativeLayout>


activity_2.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"
    >
    
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Activity 2"
        android:textSize="50sp"
    />
      <cn.com.BottomMenuView
        android:layout_width="fill_parent"
        android:layout_height="70dip"
        android:layout_alignParentBottom="true"
     />
</RelativeLayout>

 

activity_3.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"
    >
    
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Activity 3"
        android:textSize="50sp"
    />
      <cn.com.BottomMenuView
        android:layout_width="fill_parent"
        android:layout_height="70dip"
        android:layout_alignParentBottom="true"
     />
</RelativeLayout>


activity_4.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"
    >
    
    <TextView 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="Activity 4"
        android:textSize="50sp"
    />
      <cn.com.BottomMenuView
        android:layout_width="fill_parent"
        android:layout_height="70dip"
        android:layout_alignParentBottom="true"
     />
</RelativeLayout>


bottommenu.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="70dip"
    android:orientation="horizontal" >
    <LinearLayout 
        android:id="@+id/menu_LinearLayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:background="@drawable/photo1"
        android:layout_weight="1"
    />
    <LinearLayout 
        android:id="@+id/menu_LinearLayout2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:background="@drawable/photo2"
        android:layout_weight="1"
    />
    <LinearLayout 
        android:id="@+id/menu_LinearLayout3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:background="@drawable/photo3"
        android:layout_weight="1"
    />
    <LinearLayout 
        android:id="@+id/menu_LinearLayout4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:clickable="true"
        android:background="@drawable/photo4"
        android:layout_weight="1"
    />
    
</LinearLayout>


manifest.xml如下:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="cn.com"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
         <activity
            android:name=".Activity1">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
         </activity>
          <activity
            android:name=".Activity2">
         </activity>
          <activity
            android:name=".Activity3">
         </activity>
          <activity
            android:name=".Activity4">
         </activity>
    </application>

</manifest>


 

 

 

相关文章
|
4月前
|
Android开发
Android开发小技巧:怎样在 textview 前面加上一个小图标。
Android开发小技巧:怎样在 textview 前面加上一个小图标。
85 0
|
Android开发
Android自定义View水波纹
Android自定义View水波纹
Android自定义View水波纹
|
容器
Andrid自定义view:打造3D画廊
Andrid自定义view:打造3D画廊
186 0
Andrid自定义view:打造3D画廊
|
Android开发 数据格式 XML
04.自定义View(SlidingView仿QQ侧滑)
感谢红橙Darren博主 布局文件中 package com.
1102 0
|
前端开发 Android开发 数据格式
Android自定义view水波纹效果案例
想必做安卓的小伙伴都知道,在一个项目中或多或少的会使用到自定义view,因为原生框架始终满足不了UI-UE的需求,入不了他们的法眼。下面简单写一个自定义view。
1691 0
|
XML Android开发 数据格式
Android--NavigationView+DrawerLayout实现侧滑(仿QQ)
版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/chaoyu168/article/details/79271880 1、首先导包 [java] view plain copy  print? compile 'com.
1818 0
|
Android开发
Android零基础入门第56节:翻转视图ViewFlipper打造引导页和轮播图
原文:Android零基础入门第56节:翻转视图ViewFlipper打造引导页和轮播图    前面两期学习了 ViewAnimator及其子类ViewSwitcher的使用,以及ViewSwitcher的子类ImageSwitcher和TextSwitcher的使用,你都掌握了吗?本期我们一起来学习ViewAnimator另一个子类 ViewFlipper组件的使用。
1707 0
|
Android开发
自定义View解决滑动冲突
最近在读Android开发艺术探索,本文作为自己对view的滑动冲突的理解和实践记录 而滑动冲突,需要了解Android的事件分发机制,如果这个还有些疑惑的地方,请参考这篇文章,以及其中的参考文章 还需要View的Measure和Layout的相关知识View的Measure流程总结 自定义view注意 1.
1072 0