Android电话Phone UI分析

Android4.1电话呼叫界面布局设计:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/incall_screen"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.android.phone.InCallContactPhoto android:id="@+id/photo"
        		   android:layout_alignParentTop="true"
                   android:layout_width="match_parent"
                   android:layout_height="match_parent"
                   android:gravity="top|center_horizontal"
                   android:scaleType="centerCrop"
                   android:contentDescription="@string/contactPhoto"
                   android:background="@drawable/picture_unknown"/>
    <ImageView android:id="@+id/insetPhoto"
            android:layout_width="@dimen/contact_photo_inset_width"
            android:layout_height="@dimen/contact_photo_inset_height"
            android:scaleType="centerCrop"
            android:layout_marginLeft="@dimen/contact_photo_inset_left_margin"/>
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >
        <RelativeLayout
            android:id="@+id/inCallPanel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignTop="@id/inCallTouchUi" >
            <com.android.phone.CallCard
                android:id="@+id/callCard"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </RelativeLayout>
        <com.android.phone.InCallTouchUi
            android:id="@+id/inCallTouchUi"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"/>
    </RelativeLayout>
    <ViewStub android:id="@+id/otaCallCardStub"
              android:layout="@layout/otacall_card"
              android:layout_width="match_parent"
              android:layout_height="match_parent"/>
    <ViewStub android:id="@+id/manageConferencePanelStub"
              android:layout="@layout/manage_conference_panel_new_ui"
              android:layout_width="match_parent"
              android:layout_height="match_parent"/>
    <LinearLayout android:id="@+id/inCallProviderOverlay"
        android:background="@drawable/dialog_bg_calling_via"
        android:layout_width="match_parent"
        android:layout_height="88dip"
        android:layout_marginTop="@dimen/provider_overlay_top_margin"
        android:layout_gravity="top"
        android:gravity="center"
        android:visibility="gone"
        android:orientation="horizontal">
         <ImageView android:id="@+id/callingViaIcon"
            android:layout_width="40dip"
            android:layout_height="40dip"/>
        <TextView android:id="@+id/callingVia"
            android:text="@string/calling_via_template"
            android:layout_weight="1"
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:textAppearance="?android:attr/textAppearanceSmallInverse"
            android:gravity="center"/>
        <View
            android:layout_width="40dip"
            android:layout_height="40dip"/>
    </LinearLayout>
</FrameLayout>

界面效果如图:

Android电话Phone UI分析_第1张图片

InCallContactPhoto

InCallContactPhoto用于显示头像图片,该类继承于ImageView类,显示效果如下:

Android电话Phone UI分析_第2张图片

CallCard

inCallPanel是一个相对布局,该布局位于InCallTouchUi之上,在该布局中放置了一个CallCard控件,CallCard继承与LinearLayout,其布局文件为call_card.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/call_info_container"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/transparent"
    android:orientation="vertical">
    <RelativeLayout android:id="@+id/call_info_1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">
        <RelativeLayout android:id="@+id/call_banner_1"
            android:layout_alignParentBottom="true"
            android:layout_width="match_parent"
            android:layout_height="@dimen/call_banner_height_newui"
            android:paddingLeft="@dimen/call_banner_side_padding"
            android:paddingRight="@dimen/call_banner_side_padding"
            android:background="@drawable/call_storage_contact_blackbg_up_sprd">
			<FrameLayout 
	                android:id="@+id/mainCallLayout"
	                android:layout_alignParentTop="true"
	                android:gravity="center"
	                android:layout_marginTop="3dip"
	                android:layout_width="match_parent"
	                android:layout_height="wrap_content">
	          <TextView android:id="@+id/mainName"
		                android:layout_alignParentTop="true"
		                android:gravity="center"
		                android:layout_width="match_parent"
		                android:layout_height="wrap_content"
		                android:textColor="@color/incall_call_banner_text_color"
		                android:textStyle="bold"
		                android:textSize="15sp"
		                android:visibility="visible"
		                android:singleLine="true"/>
	            <!-- talk time -->
		      <TextView android:id="@+id/elapsedTime"
		                android:layout_alignParentTop="true"
		                android:gravity="center"
		                android:layout_width="match_parent"
		                android:layout_height="wrap_content"
		                android:textStyle="bold"
		                android:textColor="@color/incall_call_banner_text_color"
		                android:textSize="15sp"
		                android:visibility="gone"
			            android:singleLine="true"/>
	            <!-- recording label -->
	            <TextView android:id="@+id/recordinglabel"
			            android:layout_width="match_parent"
			            android:layout_height="wrap_content"
			            android:layout_below="@id/elapsedTime"
			            android:gravity="left"
			            android:text="@string/recording"
			            style="@style/InCallCardTextNewUI"
			            android:textAllCaps="true"
			            android:visibility="gone"/>
            </FrameLayout>
            <!-- Contacts detail -->
            <LinearLayout android:id="@+id/labelAndNumber"
                          android:layout_below="@id/mainCallLayout"
                          android:layout_marginTop="2dip"
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:gravity="center"
                          android:orientation="horizontal">
                <!--Phone type: Phone-->
                <TextView android:id="@+id/label"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          style="@style/InCallCardTextNewUI"
                          android:layout_marginLeft="3dip"
                          android:layout_marginRight="6dip"
                          android:textAllCaps="true"
                          android:singleLine="true"
                          android:ellipsize="end"/>
                            <!-- Contacts name -->
	            <TextView android:id="@+id/name"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content"
                          android:layout_gravity="center"
                          style="@style/InCallCardTextNewUI"
                          android:textAllCaps="true"
                          android:singleLine="true"
                          android:ellipsize="end"/>
                <!--Phone number-->
                <TextView android:id="@+id/phoneNumber"
                          android:layout_width="wrap_content"
                          android:layout_height="wrap_content" 
                          style="@style/InCallCardTextNewUI"
                          android:singleLine="true"
                          android:ellipsize="end"
                          android:layout_marginLeft="10dip"/>
            </LinearLayout>
			<!-- Incoming,HOLd and so on -->
             <TextView android:id="@+id/callStateLabel"
		            android:layout_width="match_parent"
		            android:layout_marginTop="2dip"
		            android:layout_height="wrap_content"
		            android:layout_below="@id/labelAndNumber"
		            android:gravity="center"
		            android:ellipsize="end"
		            style="@style/InCallCardTextNewUI"
		            android:textAllCaps="true"
		            android:visibility="gone"/>
            <!--  Internet call -->
            <TextView android:id="@+id/callTypeLabel"
                	  android:layout_marginTop="2dip"
                      android:layout_below="@id/callStateLabel"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      style="@style/InCallCardTextNewUI"
                      android:maxLines="1"
                      android:ellipsize="end"/>
            <!-- Social Status Now Not used -->
            <TextView android:id="@+id/socialStatus"
                      android:layout_marginTop="2dip"
                      android:layout_below="@id/callTypeLabel"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      style="@style/InCallCardTextNewUI"
                      android:textColor="@color/incall_call_banner_text_color"
                      android:maxLines="2"
                      android:ellipsize="end"/>
        </RelativeLayout>
    </RelativeLayout>
    <FrameLayout android:id="@+id/call_info_2"
        android:layout_width="match_parent"
        android:layout_height="40dip"
        android:background="@android:color/transparent"
        android:orientation="vertical">
        <LinearLayout android:id="@+id/call_banner_2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:paddingLeft="@dimen/call_banner_side_padding"
            android:paddingRight="@dimen/call_banner_side_padding"
            android:background="@drawable/call_storage_contact_blackbg_info_sprd">
            <TextView android:id="@+id/secondaryCallName"
                      android:layout_width="match_parent"
                      android:layout_height="25dip"
                      android:layout_weight="1"
                      android:textAppearance="?android:attr/textAppearanceMedium"
                      android:textColor="@color/incall_call_banner_text_color"
                      android:singleLine="true"/>
            <TextView android:id="@+id/secondaryCallStatus"
                      android:layout_width="match_parent"
                      android:layout_height="20dip"
                      android:layout_weight="1"
                      android:text="@string/onHold"
                      style="@style/InCallCardTextNewUI"
                      android:textColor="@color/incall_call_banner_text_color"
                      android:textAllCaps="true"
                      android:singleLine="true"/>
        </LinearLayout> 
    </FrameLayout>
</LinearLayout>

Android电话Phone UI分析_第3张图片

InCallTouchUi

InCallTouchUi控件是拨号操作界面,InCallTouchUi继承于FrameLayout布局,其对应的布局文件为incall_touch_ui.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:prvandroid="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >
    <RelativeLayout
        android:id="@+id/CallEndControls"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:visibility="gone" >
        <LinearLayout
            android:id="@+id/actionBar_normal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/call_storage_contact_blackbg_down_sprd"
            android:orientation="vertical" >
            <Button
                android:id="@+id/ContactsNew"
                android:layout_alignParentLeft="true"
                android:layout_height="60dip"
                android:layout_width="140dip"
                android:text="@string/menu_add"
                android:background="@drawable/call_button_reject" />
            <!-- Accept Call -->
            <Button
                android:id="@+id/ContactsAdd"
                android:layout_alignParentRight="true"
                android:layout_height="60dip"
                android:layout_width="140dip"
                android:text="@string/menu_edit"
                android:background="@drawable/call_button_answer" />
        </LinearLayout>
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/inComingCallControlsLocked"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:background="@android:color/transparent"
        android:visibility="gone" >
    <com.android.phone.VerticalScrollLayout
	                android:id="@+id/ScrollLayout"
	                android:layout_width="match_parent"
	                android:background="@android:color/transparent"
	                android:layout_height="200dip"/>
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/inComingCallControls"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:visibility="gone" >
        <LinearLayout
            android:id="@+id/actionBar_normal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/call_storage_contact_blackbg_down_sprd"
            android:orientation="vertical" >
            <LinearLayout
                android:id="@+id/actionBar_normal_f"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:paddingLeft="@dimen/button_cluster_side_padding"
                android:paddingRight="@dimen/button_cluster_side_padding" >
                <LinearLayout
                    android:id="@+id/handfree"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical" >
                    <ToggleButton
                        android:id="@+id/handfreeButtonImage"
                        style="@style/ImageButtonNewUi_incoming"
                        android:textOn="@null"
                        android:textOff="@null"
                        android:layout_gravity="center"
                        android:background="@drawable/btn_compound_handfree_background" />
                    <TextView
                        android:id="@+id/handfreeButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_gravity="center"
                        android:layout_marginTop="-15dip"
                        android:text="@string/onscreenSpeakerText" />
                </LinearLayout>
                <LinearLayout
                    android:id="@+id/MessageButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical" >
                    <ImageButton
                        android:id="@+id/MessageButtonImage"
                        style="@style/ImageButtonNewUi_incoming"
                        android:layout_gravity="center"
                        android:background="#00000000"
                        android:src="@drawable/call_button_feedback" />
                    <TextView
                        android:id="@+id/MessageButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_gravity="center"
                        android:layout_marginTop="-15dip"
                        android:text="@string/description_target_send_sms" />
                </LinearLayout>
                <LinearLayout
                    android:id="@+id/IncomingMuteLayout"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:orientation="vertical" >
                    <ImageButton
                        android:id="@+id/MuteButtonImage"
                        style="@style/ImageButtonNewUi_incoming"
                        android:layout_gravity="center"
                        android:background="#00000000"
                        android:src="@drawable/call_button_mute_newui" />
                    <TextView
                        android:id="@+id/MuteRingButtonLabel"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:textAppearance="?android:attr/textAppearanceSmall"
                        android:textAllCaps="true"
                        android:textColor="@color/mute_button_text"
                        android:layout_marginLeft="5dip"
                        android:layout_marginRight="5dip"
                        android:layout_gravity="center"
                        android:layout_marginTop="-15dip"
                        android:text="@string/onscreenMusicMuteText" />
                </LinearLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="@dimen/button_margin"
                android:layout_marginBottom="@dimen/button_margin"
                android:paddingLeft="@dimen/button_cluster_side_padding"
                android:paddingRight="@dimen/button_cluster_side_padding" >
                <Button
                    android:id="@+id/IncomingCallRejectButton"
                    android:layout_height="50dip"
                    android:layout_weight="1"
                    android:layout_width="match_parent"
                    android:layout_marginRight="@dimen/button_cluster_side_padding"
                    android:text="@string/description_target_decline"
                    android:textSize="20dip"
                    android:background="@drawable/call_button_reject" />
                <Button
                    android:id="@+id/IncomingCallAnswerButton"
                    android:layout_height="50dip"
                    android:layout_weight="1"
                    android:layout_width="match_parent"
                    android:layout_marginLeft="@dimen/button_cluster_side_padding"
                    android:text="@string/description_target_answer"
                    android:textSize="20dip"
                    android:background="@drawable/call_button_answer" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/inCallControls"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:visibility="gone" >
        <LinearLayout
                android:id="@+id/manageConferenceButton"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:background="@android:color/transparent"
                android:gravity="center"
                android:orientation="horizontal" >
                <ImageButton
                    android:id="@+id/manageConferenceButtonImage"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:layout_gravity="center"
                    android:background="@android:color/transparent"
                    android:contentDescription="@string/onscreenManageConferenceText"
                    android:src="@drawable/btn_compound_conference_newui" />
                <TextView
                    android:id="@+id/manageConferenceButtonLabel"
                    style="@style/InCallExtraRowButtonLabelNewUI"
                    android:layout_marginTop="10dip"
                    android:layout_gravity="center"
                    android:visibility="gone"
                    android:text="@string/onscreenManageConferenceText" />
            </LinearLayout>
        <LinearLayout
            android:id="@+id/bottomButtons"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:background="@drawable/call_storage_contact_blackbg_down_sprd"
            android:orientation="vertical" >
        <FrameLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content">
            <FrameLayout
                android:id="@+id/extraButtonRow"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:visibility="gone"
                android:paddingLeft="@dimen/button_cluster_side_padding"
                android:paddingRight="@dimen/button_cluster_side_padding" >
                <LinearLayout
                    android:id="@+id/cdmaMergeButton"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="?android:attr/selectableItemBackground"
                    android:orientation="horizontal" >
                    <ImageButton
                        android:id="@+id/cdmaMergeButtonImage"
                        style="@style/InCallButton"
                        android:clickable="false"
                        android:contentDescription="@string/onscreenMergeCallsText"
                        android:src="@drawable/ic_merge_holo_dark" />
                    <TextView
                        android:id="@+id/cdmaMergeButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:text="@string/onscreenMergeCallsText" />
                </LinearLayout>
            </FrameLayout>
			<LinearLayout
                android:id="@+id/bottomButtonsRow2"
                android:layout_width="match_parent"
                android:layout_height="80dip"
                android:visibility="visible"
                android:gravity="center_vertical"
                android:orientation="horizontal">
                <LinearLayout
	                android:layout_width="match_parent"
	                android:layout_height="80dip"
	                android:gravity="center_horizontal"
	                android:layout_weight="1"
	                android:orientation="vertical" >
	                <ToggleButton
	                    android:id="@+id/menuPhoneRecorder"
	                    style="@style/InCallButtonNewUi"
	                    android:layout_gravity="center"
	                    android:layout_marginRight="6dip"
	                    android:background="@drawable/btn_compound_record_newui"
	                    android:contentDescription="@string/onscreenShowRecodText" />
	                <TextView
                        android:id="@+id/menuPhoneRecorderLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_marginRight="6dip"
                        android:layout_gravity="center"
                        android:singleLine="true"
                        android:layout_marginTop="-15dip"
                        android:text="@string/audio_db_album_name" />
	            </LinearLayout>
                <LinearLayout
	                android:layout_width="match_parent"
	                android:layout_height="80dip"
	                android:layout_gravity="center"
					android:gravity="center_horizontal"
	                android:layout_weight="1"
	                android:orientation="vertical" >
	                <ToggleButton
	                    android:id="@+id/holdButton"
	                    android:gravity="center"
	                    style="@style/ImageButtonNewUi_new"
	                    android:textOn="@null"
	                    android:textOff="@null"
	                    android:layout_marginTop="24dip"
	                    android:background="@drawable/btn_compound_hold_newui"
	                    android:contentDescription="@string/onscreenHoldText" />
	                <ImageButton
	                    android:id="@+id/swapButton"
	                    style="@style/ImageButtonNewUi_new"
	                    android:scaleType="center"
	                    android:background="#00000000"
	                    android:layout_marginTop="24dip"
	                    android:contentDescription="@string/onscreenSwapCallsText"
	                    android:src="@drawable/btn_compound_switch_newui" />
	                <TextView
                        android:id="@+id/holdButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_gravity="center"
                        android:singleLine="true"
                        android:layout_marginTop="6dip"
                        android:text="@string/card_title_on_hold" />
				</LinearLayout>
                <LinearLayout
	                android:layout_width="match_parent"
	                android:layout_height="80dip"
	                android:gravity="center_horizontal"
	                android:layout_weight="1"
	                android:layout_marginTop="24dip"
	                android:orientation="vertical" >
	                <ImageButton
	                    android:id="@+id/addButton"
	                    style="@style/ImageButtonNewUi_new"
	                    android:layout_marginLeft="6dip"
	                    android:scaleType="center"
	                    android:background="#00000000"
	                    android:contentDescription="@string/onscreenAddCallText"
	                	android:src="@drawable/btn_compound_merge_background_newui" />
	                <ImageButton
	                    android:id="@+id/mergeButton"
	                    style="@style/ImageButtonNewUi_new"
	                    android:layout_marginLeft="6dip"
	                    android:scaleType="center"
	                    android:background="#00000000"
	                    android:contentDescription="@string/onscreenMergeCallsText"
	               		android:src="@drawable/btn_compound_merge_button_newui" />
	                <TextView
                        android:id="@+id/addButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_marginTop="6dip"
                        android:layout_marginLeft="2dip"
                        android:singleLine="true"
                        android:layout_gravity="center"
                        android:text="@string/selectContact" />
				</LinearLayout>
            </LinearLayout>
	        <ViewStub
	            android:id="@+id/dtmf_twelve_key_dialer_stub"
	            android:layout_width="match_parent"
	            android:layout_height="match_parent"
	            android:background="@android:color/transparent"
	            android:layout="@layout/dtmf_twelve_key_dialer_view_newui" />
	        </FrameLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="80dip"
                android:orientation="horizontal" 
                android:visibility="visible"
                android:gravity="center_vertical">
				<LinearLayout
	                android:layout_width="match_parent"
	                android:layout_height="80dip"
	                android:gravity="center_horizontal"
	                android:layout_weight="1"
	                android:orientation="vertical" >
	                <ToggleButton
	                    android:id="@+id/audioButton"
	                    android:gravity="center"
	                    style="@style/InCallButtonNewUi"
	                    android:layout_marginRight="6dip"
	                    android:background="@drawable/btn_compound_audio_newui"
	                    android:contentDescription="@string/onscreenAudioText" />
	                <TextView
                        android:id="@+id/audioButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_gravity="center"
                        android:layout_marginRight="6dip"
                        android:singleLine="true"
                        android:layout_marginTop="-15dip"
                        android:text="@string/onscreenSpeakerText" />
	            </LinearLayout>
	            <LinearLayout
	                android:layout_width="match_parent"
	                android:layout_height="80dip"
	                android:layout_weight="1"
	                android:gravity="center_horizontal"
	                android:layout_gravity="center"
	                android:orientation="vertical" >
	                <ToggleButton
	                    android:id="@+id/dialpadButton"
	                    android:gravity="center"
	                    style="@style/InCallButtonNewUi"
	                    android:background="@drawable/btn_compound_keyboard_newui"
	                    android:contentDescription="@string/video_btn_dialer" />
	                <TextView
                        android:id="@+id/dialpadButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:layout_gravity="center"
                        android:layout_marginTop="-15dip"
                        android:singleLine="true"
                        android:text="@string/video_btn_dialer" />
				</LinearLayout>
				<LinearLayout
	                android:layout_width="match_parent"
	                android:layout_height="80dip"
	                android:layout_weight="1"
	                android:layout_gravity="center_horizontal"
	                android:orientation="vertical" >
	                <ToggleButton
	                    android:id="@+id/muteButton"
	                    style="@style/InCallButtonNewUi"
	                    android:layout_gravity="center"
	                    android:layout_marginLeft="6dip"
	                    android:background="@drawable/btn_compound_mute_newui"
	                    android:contentDescription="@string/onscreenMuteText" />
	                <TextView
                        android:id="@+id/muteButtonLabel"
                        style="@style/InCallExtraRowButtonLabelNewUI"
                        android:singleLine="true"
                        android:layout_gravity="center"
                        android:layout_marginLeft="4dip"
                        android:layout_marginTop="-15dip"
                        android:text="@string/video_mute" />
	            </LinearLayout>
            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="84dip"
                android:paddingLeft="@dimen/button_cluster_side_padding_newui"
                android:paddingRight="@dimen/button_cluster_side_padding_newui"
                android:orientation="horizontal" >
                <Button
                    android:id="@+id/endButton"
                    style="@style/InCallEndButtonNewUI"
                    android:layout_marginTop="20dip"
                	android:layout_marginBottom="@dimen/button_cluster_side_padding_newui"
                    android:layout_width="match_parent"
                    android:text="@string/onscreenEndCallText"
                    android:textColor="@color/incall_call_banner_text_color"
                    android:contentDescription="@string/onscreenEndCallText"
                    android:background="@drawable/call_button_reject" />
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
</RelativeLayout>

该布局定义了电话拨号及电话接听控制界面,电话拨号控制界面效果图如下:

Android电话Phone UI分析_第4张图片

电话接听控制界面效果图如下:

Android电话Phone UI分析_第5张图片

拨号键盘dtmf_twelve_key_dialer_stub布局文件为dtmf_twelve_key_dialer_view_newui.xml

<com.android.phone.DTMFTwelveKeyDialerView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dtmf_twelve_key_dialer_view_newui"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:layout_marginTop="1dip"
    android:background="@android:color/transparent"
    android:visibility="gone"
    >
    <!-- 号码显示控件 -->
    <EditText
        android:id="@+id/dtmfDialerField"
        android:layout_width="match_parent"
        android:layout_height="83dp"
        android:paddingRight="16dp"
        android:paddingLeft="16dp"
        android:singleLine="true"
        android:scrollHorizontally="true"
        android:textSize="40sp"
        android:gravity="center"
        android:freezesText="true"
        android:background="@android:color/transparent"
        android:textColor="@color/dtmf_dialer_display_text"
        android:focusableInTouchMode="false"
        android:clickable="false"/>

    <!-- 拨号键盘 -->
    <include layout="@layout/dialpad_newui" />
</com.android.phone.DTMFTwelveKeyDialerView>

拨号键盘界面定义在dialpad_newui.xml中

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/dialpad"
    android:layout_width="match_parent"
    android:layout_height="262dip"
    android:layout_gravity="center_horizontal"
    android:background="@android:color/transparent"
    android:layout_weight="@integer/dialpad_layout_weight_dialpad">
    <TableRow
        android:layout_height="0px"
        android:layout_weight="1" >
        <ImageButton
            android:id="@+id/one"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_one"
            android:src="@drawable/dial_num_1_no_vm_newui"
            android:background="@drawable/btn_dialpad_1_bg"/>
        <ImageButton
            android:id="@+id/two"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_two"
            android:src="@drawable/dial_num_2_newui"
            android:background="@drawable/btn_dialpad_3_bg"/>
        <ImageButton
            android:id="@+id/three"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_three"
            android:src="@drawable/dial_num_3_newui"
            android:background="@drawable/btn_dialpad_1_bg"/>
    </TableRow>

    <TableRow
        android:layout_height="0px"
        android:layout_weight="1">
        <ImageButton
            android:id="@+id/four"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_four"
            android:src="@drawable/dial_num_4_newui"
            android:background="@drawable/btn_dialpad_1_bg"/>
        <ImageButton
            android:id="@+id/five"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_five"
            android:src="@drawable/dial_num_5_newui"
            android:background="@drawable/btn_dialpad_3_bg"/>
        <ImageButton
            android:id="@+id/six"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_six"
            android:src="@drawable/dial_num_6_newui"
            android:background="@drawable/btn_dialpad_1_bg"/>
    </TableRow>

    <TableRow
        android:layout_height="0px"
        android:layout_weight="1">
        <ImageButton
            android:id="@+id/seven"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_seven"
            android:src="@drawable/dial_num_7_newui"
            android:background="@drawable/btn_dialpad_1_bg"/>
        <ImageButton
            android:id="@+id/eight"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_eight"
            android:src="@drawable/dial_num_8_newui"
            android:background="@drawable/btn_dialpad_3_bg"/>
        <ImageButton
            android:id="@+id/nine"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_nine"
            android:src="@drawable/dial_num_9_newui"
            android:background="@drawable/btn_dialpad_1_bg"/>
    </TableRow>

    <TableRow
        android:layout_height="0px"
        android:layout_weight="1">
        <ImageButton
            android:id="@+id/star"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_star"
            android:src="@drawable/dial_num_star_newui"
            android:background="@drawable/btn_dialpad_2_bg"/>
        <ImageButton
            android:id="@+id/zero"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_zero"
            android:src="@drawable/dial_num_0_no_plus_newui"
            android:background="@drawable/btn_dialpad_4_bg"/>
        <ImageButton
            android:id="@+id/pound"
            style="@style/DialpadButtonStyleNewui"
            android:contentDescription="@string/description_image_button_pound"
            android:src="@drawable/dial_num_pound_newui"
            android:background="@drawable/btn_dialpad_2_bg"/>
    </TableRow>
</TableLayout>

效果图如下所示:

Android电话Phone UI分析_第6张图片

你可能感兴趣的:(android,phone)