Android自定義控制項2--優酷菜單界面初始化

来源:http://www.cnblogs.com/wuyudong/archive/2016/09/27/5912538.html
-Advertisement-
Play Games

本文開始將逐步去實現下麵優酷菜單的效果: 本文地址:http://www.cnblogs.com/wuyudong/p/5912538.html,轉載請註明源地址。 本文首先來實現優酷菜單界面初始化工作 首先使用相對佈局 實現下麵的效果 接著將一些小圖標嵌入裡面,佈局比較簡單有規律 運行後的效果如下 ...


本文開始將逐步去實現下麵優酷菜單的效果:

本文地址:http://www.cnblogs.com/wuyudong/p/5912538.html,轉載請註明源地址。

本文首先來實現優酷菜單界面初始化工作

首先使用相對佈局

<RelativeLayout 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"
    tools:context=".MainActivity" >
    
    <RelativeLayout 
        android:layout_width="100dp"
        android:layout_height="50dp"
        android:background="@drawable/level1"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ></RelativeLayout>

    <RelativeLayout 
        android:layout_width="180dp"
        android:layout_height="90dp"
        android:background="@drawable/level2"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ></RelativeLayout>
    <RelativeLayout 
        android:layout_width="280dp"
        android:layout_height="140dp"
        android:background="@drawable/level3"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        ></RelativeLayout>
</RelativeLayout>

實現下麵的效果

接著將一些小圖標嵌入裡面,佈局比較簡單有規律

<RelativeLayout 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"
    tools:context=".MainActivity" >

    <RelativeLayout
        android:layout_width="100dp"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/level1" >

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:background="@null"
            android:src="@drawable/icon_home" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="180dp"
        android:layout_height="90dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/level2" >
          <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="10dp"
            android:background="@null"
            android:src="@drawable/icon_search" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="5dp"
            android:background="@null"
            android:src="@drawable/icon_menu" />
         <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="5dp"
            android:layout_marginRight="10dp"
            android:background="@null"
            android:src="@drawable/icon_myyouku" />
    </RelativeLayout>

    <RelativeLayout
        android:layout_width="280dp"
        android:layout_height="140dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/level3" >

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_marginBottom="5dp"
            android:layout_marginLeft="10dp"
            android:background="@null"
            android:src="@drawable/channel1" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="30dp"
            android:layout_marginTop="60dp"
            android:background="@null"
            android:src="@drawable/channel2" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="65dp"
            android:layout_marginTop="25dp"
            android:background="@null"
            android:src="@drawable/channel3" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="5dp"
            android:background="@null"
            android:src="@drawable/channel4" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="30dp"
            android:layout_marginTop="60dp"
            android:background="@null"
            android:src="@drawable/channel5" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_marginRight="65dp"
            android:layout_marginTop="25dp"
            android:background="@null"
            android:src="@drawable/channel6" />

        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginBottom="5dp"
            android:layout_marginRight="10dp"
            android:background="@null"
            android:src="@drawable/channel7" />
    </RelativeLayout>

</RelativeLayout>

運行後的效果如下:


您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 前兩天上架App遇到一個比較神奇的問題,打包好的項目使用Application Loader上傳成功,但是在iTunes裡面卻找不到構建版本,App的活動頁面也沒有相應的版本。 之前瞭解IOS10對用戶的安全和隱私的增強,在申請很多私有許可權的時候都需要添加描述,但是,在使用Xcode 8對原有項目編 ...
  • 實際上都是互補的,也就是說一些原則需要利用另一些原則來實現自己。 6大原則如下: 1)單一職責原則,一個合理的類,應該僅有一個引起它變化的原因,即單一職責,就是設計的這個類功能應該只有一個; 優點:消除耦合,減小因需求變化引起代碼僵化。 2) 開-閉原則,講的是設計要對擴展有好的支持,而對修改要嚴格 ...
  • 此外不在更新 地址: ...
  • 實現類似下麵的這種佈局的方法 ...
  • 在上篇文章中實現了優酷菜單的佈局,本文接著實現動畫功能 本文地址:http://www.cnblogs.com/wuyudong/p/5914901.html,轉載請註明源地址。 新建動畫工具類AnimationUtils.java,代碼如下: 接著編寫邏輯部分代碼: 基本實現菜單的旋轉功能 ...
  • 因為我在模仿美圖秀秀的功能,在使用相冊時候,UIImagePickerController本來就是一個UINavigationController的子類,所以沒有辦法使用push,所以做了一個自定義的非UINavigationController子類的相冊。使用的api是ios8以上提供的photo ...
  • 兩類絕對時間[NSDate date]、CFAbsoluteTimeGetCurrent(),或者gettimeofday()。 返回的是從某一個時刻開始,度過的秒數。會隨著用戶設置的系統時間更改。相對時間CACurrentMediaTime 或者-[NSProcessInfo systemUpti... ...
  • 博客撰寫人:It一zhai男 轉載請標明地址:http://www.cnblogs.com/ityizhainan/p/5914487.html 本文將用兩個方法來寫類似汽車荷載的進度 先上截圖 1. 用LinearLayout的addview方法加上for迴圈 1.1 processtest01. ...
一周排行
    -Advertisement-
    Play Games
  • 前言 本文介紹一款使用 C# 與 WPF 開發的音頻播放器,其界面簡潔大方,操作體驗流暢。該播放器支持多種音頻格式(如 MP4、WMA、OGG、FLAC 等),並具備標記、實時歌詞顯示等功能。 另外,還支持換膚及多語言(中英文)切換。核心音頻處理採用 FFmpeg 組件,獲得了廣泛認可,目前 Git ...
  • OAuth2.0授權驗證-gitee授權碼模式 本文主要介紹如何筆者自己是如何使用gitee提供的OAuth2.0協議完成授權驗證並登錄到自己的系統,完整模式如圖 1、創建應用 打開gitee個人中心->第三方應用->創建應用 創建應用後在我的應用界面,查看已創建應用的Client ID和Clien ...
  • 解決了這個問題:《winForm下,fastReport.net 從.net framework 升級到.net5遇到的錯誤“Operation is not supported on this platform.”》 本文內容轉載自:https://www.fcnsoft.com/Home/Sho ...
  • 國內文章 WPF 從裸 Win 32 的 WM_Pointer 消息獲取觸摸點繪製筆跡 https://www.cnblogs.com/lindexi/p/18390983 本文將告訴大家如何在 WPF 裡面,接收裸 Win 32 的 WM_Pointer 消息,從消息裡面獲取觸摸點信息,使用觸摸點 ...
  • 前言 給大家推薦一個專為新零售快消行業打造了一套高效的進銷存管理系統。 系統不僅具備強大的庫存管理功能,還集成了高性能的輕量級 POS 解決方案,確保頁面載入速度極快,提供良好的用戶體驗。 項目介紹 Dorisoy.POS 是一款基於 .NET 7 和 Angular 4 開發的新零售快消進銷存管理 ...
  • ABP CLI常用的代碼分享 一、確保環境配置正確 安裝.NET CLI: ABP CLI是基於.NET Core或.NET 5/6/7等更高版本構建的,因此首先需要在你的開發環境中安裝.NET CLI。這可以通過訪問Microsoft官網下載並安裝相應版本的.NET SDK來實現。 安裝ABP ...
  • 問題 問題是這樣的:第三方的webapi,需要先調用登陸介面獲取Cookie,訪問其它介面時攜帶Cookie信息。 但使用HttpClient類調用登陸介面,返回的Headers中沒有找到Cookie信息。 分析 首先,使用Postman測試該登陸介面,正常返回Cookie信息,說明是HttpCli ...
  • 國內文章 關於.NET在中國為什麼工資低的分析 https://www.cnblogs.com/thinkingmore/p/18406244 .NET在中國開發者的薪資偏低,主要因市場需求、技術棧選擇和企業文化等因素所致。歷史上,.NET曾因微軟的閉源策略發展受限,儘管後來推出了跨平臺的.NET ...
  • 在WPF開發應用中,動畫不僅可以引起用戶的註意與興趣,而且還使軟體更加便於使用。前面幾篇文章講解了畫筆(Brush),形狀(Shape),幾何圖形(Geometry),變換(Transform)等相關內容,今天繼續講解動畫相關內容和知識點,僅供學習分享使用,如有不足之處,還請指正。 ...
  • 什麼是委托? 委托可以說是把一個方法代入另一個方法執行,相當於指向函數的指針;事件就相當於保存委托的數組; 1.實例化委托的方式: 方式1:通過new創建實例: public delegate void ShowDelegate(); 或者 public delegate string ShowDe ...