To put it bluntly, there is a picture of the truth.
The two toolbars are implemented by layout. Code for bottom toolbar layout:
Code
Copy codeThe Code is as follows: <xmlns: android = "http://schemas.android.com/apk/res/android"
Android: background = "@ drawable/bottom"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/edit"
Android: text = "test"
Android: gravity = "center_horizontal"
Android: drawableTop = "@ drawable/ic_dialog_alert"
Android: layout_alignParentLeft = "true"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/menu2"
Android: text = "test"
Android: gravity = "center_horizontal"
Android: drawableTop = "@ drawable/ic_dialog_dialer"
Android: layout_toRightOf = "@ id/edit"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/effect"
Android: text = "test"
Android: gravity = "center_horizontal"
Android: drawableTop = "@ drawable/ic_dialog_email"
Android: layout_toRightOf = "@ id/menu2"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/menu3"
Android: text = "test"
Android: gravity = "center_horizontal"
Android: drawableTop = "@ drawable/ic_dialog_info"
Android: layout_toRightOf = "@ id/effect"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
Top toolbar layout code:
Code
Copy codeThe Code is as follows: <xmlns: android = "http://schemas.android.com/apk/res/android"
Android: background = "@ drawable/top"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/undo"
Android: src = "@ drawable/ic_dialog_map"
Android: layout_alignParentLeft = "true"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/save"
Android: src = "@ drawable/ic_dialog_menu_generic"
Android: layout_toRightOf = "@ id/undo"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/share"
Android: src = "@ drawable/ic_dialog_time"
Android: layout_toRightOf = "@ id/save"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
<Android: id = "@ + id/redo"
Android: src = "@ drawable/ic_dialog_usb"
Android: layout_toRightOf = "@ id/share"
Android: layout_width = "80dip"
Android: layout_height = "wrap_content"
>
Main Window layout code:
Code
Copy codeThe Code is as follows: <android: layout_height = "fill_parent">
Xmlns: android = "http://schemas.android.com/apk/res/android"
Android: id = "@ + id/layout_topmenu"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: layout_alignParentTop = "true"
>
<Android: text = "asdfasdfas"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/layout_topmenu">
<Xmlns: android = "http://schemas.android.com/apk/res/android"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: layout_alignParentBottom = "true"
>
Main Window code:
Code
Copy codeThe Code is as follows: package com. figoyu. photoqualify;
Import android. app. Activity;
Import android. OS. Bundle;
Import android. view. MotionEvent;
Import android. view. View;
Import android. view. Window;
Import android. view. View. OnTouchListener;
Import android. widget. ImageView;
Import android. widget. TextView;
Public class MainActivity extends Activity {
TextView txt1;
TextView edittv;
ImageView imgbtn;
Boolean isFirst = true;
Boolean istopFirst = true;
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
RequestWindowFeature (Window. FEATURE_NO_TITLE );
SetContentView (R. layout. main );
Edittv = (TextView) findViewById (R. id. edit );
Txt1 = (textview1_findviewbyid(r.id.txt 1 );
Imgbtn = (ImageView) findViewById (R. id. undo );
Edittv. setOnTouchListener (new OnTouchListener (){
@ Override
Public boolean onTouch (View v, MotionEvent event ){
If (isFirst ){
Txt1.setText ("edit ");
Edittv. setBackgroundDrawable (getResources (). getDrawable (R. drawable. item_background ));
IsFirst = false;
} Else {
Txt1.setText ("Exit editing ");
Edittv. setBackgroundDrawable (getResources (). getDrawable (R. drawable. touming ));
IsFirst = true;
}
Return false;
}
});
Imgbtn. setOnTouchListener (new OnTouchListener (){
@ Override
Public boolean onTouch (View v, MotionEvent event ){
If (istopFirst ){
Txt1.setText ("edit ");
IstopFirst = false;
} Else {
Txt1.setText ("Exit editing ");
IstopFirst = true;
}
Return false;
}
});
}
}