Sunteți pe pagina 1din 24

Option Menu

Android Option Menus are the primary menus of android. They can be used for
settings, search, delete item etc.

Here, we are going to see two examples of option menus. First, the simple option menus
and second, options menus with images.

Here, we are inflating the menu by calling the inflate() method of MenuInflater class.
To perform event handling on menu items, you need to
override onOptionsItemSelected() method of Activity class.

Android Option Menu Example


Let's see how to create menu in android. Let's see the simple option menu example that
contains three menu items.

activity_main.xml

We have only one textview in this file.

File: activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<android.support.design.widget.CoordinatorLayout xmlns:android="http://sc
hemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.javatpoint.com.optionmenu.MainActivity">

<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">

<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />


</android.support.design.widget.CoordinatorLayout>
File: context_main.xml

<?xml version="1.0" encoding="utf-8"?>


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas
.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="example.javatpoint.com.optionmenu.MainActivity"
tools:showIn="@layout/activity_main">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

menu_main.xml

It contains three items as show below. It is created automatically inside the


res/menu directory.

File: menu_main.xml

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="example.javatpoint.com.optionmenu.MainActivity">

<item android:id="@+id/item1"
android:title="Item 1"/>
<item android:id="@+id/item2"
android:title="Item 2"/>
<item android:id="@+id/item3"
android:title="Item 3"
app:showAsAction="withText"/>
</menu>
Activity class

This class displays the content of menu.xml file and performs event handling on clicking
the menu items.

File: MainActivity.java

package example.javatpoint.com.optionmenu;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
switch (id){
case R.id.item1:
Toast.makeText(getApplicationContext(),"Item 1 Selected",Toast.LENGTH_LONG)
.show();
return true;
case R.id.item2:
Toast.makeText(getApplicationContext(),"Item 2 Selected",Toast.LENGTH_LONG)
.show();
return true;
case R.id.item3:
Toast.makeText(getApplicationContext(),"Item 3 Selected",Toast.LENGTH_LONG)
.show();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}

Output without clicking on the menu button.

Output after clicking on the menu button.


Android Context Menu
Android context menu appears when user press long click on the element. It is also
known as floating menu.

It affects the selected content while doing action on it.

It doesn't support item shortcuts and icons.

Android Context Menu


Let's see the simple example of context menu in android.

activity_main.xml

Drag one listview from the pallete, now the xml file will look like this:

File: activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.an
droid.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.javatpoint.com.contextmenu.MainActivity">

<ListView
android:layout_width="368dp"
android:layout_height="495dp"
android:id="@+id/listView"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

main_menu.xml

Create a separate menu_main.xml file in menu directory for menu items.

<?xml version="1.0" encoding="utf-8"?>


<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/call"
android:title="Call" />
<item android:id="@+id/sms"
android:title="SMS" />
</menu>

Activity class

Let's write the code to display the context menu on press of the listview.

File: MainActivity.java

package example.javatpoint.com.contextmenu;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


ListView listView;
String contacts[]={"Ajay","Sachin","Sumit","Tarun","Yogesh"};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listView=(ListView)findViewById(R.id.listView);
ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.sim
ple_list_item_1,contacts);
listView.setAdapter(adapter);
// Register the ListView for Context menu
registerForContextMenu(listView);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMe
nuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu_main, menu);
menu.setHeaderTitle("Select The Action");
}
@Override
public boolean onContextItemSelected(MenuItem item){
if(item.getItemId()==R.id.call){
Toast.makeText(getApplicationContext(),"calling code",Toast.LENGTH_LONG).show(
);
}
else if(item.getItemId()==R.id.sms){
Toast.makeText(getApplicationContext(),"sending sms code",Toast.LENGTH_LONG).
show();
}else{
return false;
}
return true;
}
}

Output:

Output after long press on the listview.


Android Popup Menu
Android Popup Menu displays the menu below the anchor text if space is available
otherwise above the anchor text. It disappears if you click outside the popup menu.

The android.widget.PopupMenu is the direct subclass of java.lang.Object class.

Android Popup Menu Example


Let's see how to create popup menu in android.

activity_main.xml

It contains only one button.

File: activity_main.xml

<?xml version="1.0" encoding="utf-8"?>


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.androi
d.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="example.javatpoint.com.popupmenu.MainActivity">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/button"
android:text="Click"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>

popup_menu.xml

It contains three items as show below. It is created inside the res/menu directory.

File: poupup_menu.xml

<?xml version="1.0" encoding="utf-8"?>


<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/one"
android:title="One" />
<item
android:id="@+id/two"
android:title="Two"/>
<item
android:id="@+id/three"
android:title="Three"/>
</menu>

Activity class

It displays the popup menu on button click.

File: MainActivity.java
package example.javatpoint.com.popupmenu;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.PopupMenu;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {


Button button;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

button = (Button) findViewById(R.id.button);


button.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {
//Creating the instance of PopupMenu
PopupMenu popup = new PopupMenu(MainActivity.this, button);
//Inflating the Popup using xml file
popup.getMenuInflater().inflate(R.menu.popup_menu, popup.getMenu());

//registering popup with OnMenuItemClickListener


popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener()
{
public boolean onMenuItemClick(MenuItem item) {
Toast.makeText(MainActivity.this,"You Clicked : " + item.getTitle(), Toast.L
ENGTH_SHORT).show();
return true;
}
});

popup.show();//showing popup menu


}
});//closing the setOnClickListener method
}
}

Output:

ArrayAdapter
In android, An adapter is a bridge between UI component and data source that helps
us to fill data in UI component. It holds the data and send the data to adapterview
then view can takes the data from the adapter view and shows the data on different
views like listview, gridview, spinner etc. ArrayAdapter is more simple and commonly
used Adapter in android.

 Whenever you have a list of single type of items which is backed by an array,
you can use ArrayAdapter. For instance, list of phone contacts, countries or
names.
 By default, ArrayAdapter expects a Layout with a single TextView, If you want
to use more complex views means more customization in grid items or list
items, please avoid ArrayAdapter and use custom adapters.

Important Note: ArrayAdapter is an implementation of BaseAdapter so if we need to


create a custom list view or a grid view then we have to create our own custom
adapter and extend ArrayAdapter in that custom class. By doing this we can
override all the function’s of BaseAdapter in our custom adapter.
Here is code of ArrayAdapter in Android:

ArrayAdapter(Context context, int resource, int textViewResourceId, T[] objects)

In the above code snippet is the implementation of a ArrayAdapter. Below is the


description of all the parameters used for the implementation of a ArrayAdapter to
show a list of elements in a list view or in a spinner.
Parameters used in ArrayAdapter:
Lets discuss parameter in ArrayAdapter class:

 context:

The first parameter is used to pass the context means the reference of current class.
Here this is a keyword used to show the current class reference. We can also use
getApplicationContext(), getActivity() in the place of this keyword.
getApplicationContext() is used in a Activity and getActivity() is used in a Fragment.
Below is the example code in which we set the current class reference in a adapter.

ArrayAdapter arrayAdapter = new ArrayAdapter(this, int resource, int textViewResou


rceId, T[] objects);

 resource:

The second parameter is resource id used to set the layout(xml file) for list items in
which you have a text view.
Below is the example code in which we set the layout.
ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.list_view_items, int t
extViewResourceId, T[] objects);

 textViewResourceId:

The third parameter is textViewResourceId which is used to set the id


of TextViewwhere you want to display the actual text.
Below is the example code in which we set the id(identity) of a text view.

ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.list_view_items, R.id.


textView, T[] objects);

 objects:

The fourth parameter is an array of objects, used to set the array of elements in
the textView. We can set the object of array or array list here.
Below is the example code in which we set the Animal array in adapter to display the
Animal name’s list.

String animalList[] = {"Lion","Tiger","Monkey","Elephant","Dog","Cat","Camel"};


ArrayAdapter arrayAdapter = new ArrayAdapter(this, R.layout.list_view_items, R.id.
textView, animalList);

Example of an ArrayAdapter:
Example 1: Below is the example, in which we displays a list of animal names in a list
view using simple array adapter. Below is the final output and code:

Step 1: Create a new project and name it ArrayAdapterExample.


Open Android Studio -> Select File -> New -> New Project. Fill the forms and click
"Finish" button.

Step 2: Now open app -> res -> layout -> xml (or) activity_main.xml and add following
code :

<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">

<ListView
android:id="@+id/simpleListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#000"
android:dividerHeight="2dp"/>

</RelativeLayout>

Step 3: Create a new Activity activity_list_view.xml and add the below code

<?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="match_parent"
android:orientation="vertical">

<TextView
android:id="@+id/textView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="@dimen/activity_horizontal_margin"
android:textColor="#000" />
</LinearLayout>
Step 4: Now Open app -> java -> package -> MainActivity.java and add the below code.
Here we will use ArrayAdapter to display the items in Listview.

package example.abhiandriod.arrayadapterexample; //use package of your project

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends AppCompatActivity {


// Array of strings...
ListView simpleList;
String animalList[] = {"Lion","Tiger","Monkey","Elephant","Dog","Cat","Camel"}
;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
simpleList = (ListView) findViewById(R.id.simpleListView);

ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, R.layou


t.activity_list_view, R.id.textView, animalList);
simpleList.setAdapter(arrayAdapter);
}

}
}

Output:
Now run the App in Emulator and you will see the below output:
Example 2: Below is the example, In which we display a list of Animal’s name
in spinner using ArrayAadapter. Below is the final output and code:

Step 1: Create a new project and name it ArrayAdapterExample.


Select File -> New -> New Project. Fill the forms and click "Finish" button.

Step 2: Now open app -> res -> layout -> activity_main.xml (or) main.xml and add
following code:

<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">

<Spinner
android:id="@+id/animalNamesSpinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>

</RelativeLayout>

Step 3: Now create a new Activity simple_spinner_item.xml and add the below code:

<?xml version="1.0" encoding="utf-8"?>


<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:textAlignment="inherit"/>

Step 4: Now open app -> java -> package -> MainActivity.java and add the following
code

package example.abhiandriod.arrayadapterexample;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;

public class MainActivity extends Activity implements


AdapterView.OnItemSelectedListener {
// Array of strings...
String animalList[] = {"Lion", "Tiger", "Monkey", "Elephant", "Dog", "Cat", "C
amel"};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Getting the instance of Spinner and applying OnItemSelectedListener on i
t
Spinner spin = (Spinner) findViewById(R.id.animalNamesSpinner);
spin.setOnItemSelectedListener(this);

//Creating the ArrayAdapter instance having the animal name's list


ArrayAdapter aa = new ArrayAdapter(this, android.R.layout.simple_spinner_i
tem, animalList);
aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
//Setting the ArrayAdapter data on the Spinner
spin.setAdapter(aa);
}

//Performing action onItemSelected and onNothing selected


@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long
id) {
Toast.makeText(getApplicationContext(), animalList[position], Toast.LENGTH
_LONG).show();
}

@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub

}
}

Output:
Now run the App in Emulator you will see the animals name listed in a Spinner
BaseAdapter In Android Studio
Before we share BaseAdapter it is first important to revise Adapter. In android,
an adapter is a bridge between UI component and data source that helps us to fill data
in the UI component. It holds the data and send the data to adapter view then view
can takes the data from the adapter view and shows the data on different views like
as list view, grid view, spinner etc. For more customization of views we uses the base
adapter. Now lets discuss BaseAdapter class.

 BaseAdapter is a common base class of a general implementation of an Adapter


that can be used in ListView, GridView, Spinner etc.
 Whenever you need a customized list in a ListView or customized grids in
a GridView you create your own adapter and extend base adapter in that.
 Base Adapter can be extended to create a custom Adapter for displaying a
custom list item.

Important Note: ArrayAdapter is also an implementation of BaseAdapter.


Here is the code of Custom Adapter when we extends the BaseAdapter in that:

public class CustomAdapter extends BaseAdapter {

@Override
public int getCount() {
return 0;
}

@Override
public Object getItem(int i) {
return null;
}

@Override
public long getItemId(int i) {
return 0;
}

@Override
public View getView(int i, View view, ViewGroup viewGroup) {

return null;
}

In the above code snippet we see the overrided methods of BaseAdapter which are
used to set the data in a list, grid or a spinner. From there we mainly used two
functions getCount() and getView().
Let’s discuss all these functions in detail:
1. getCount():
The getCount() function returns the total number of items to be displayed in a list. It
counts the value from array list size() method or an array’s length. For example, if we
have an list of elements in an arraylist and we have to display the items in a list
view then we can count the total number of elements using the size function and then
that integer value is returned by the function getCount() as shown below.

@Override
public int getCount() {
int count=arrayList.size(); //counts the total number of elements from the arrayLi
st
return count;//returns the total count to adapter
}

2. getView(int i, View view, ViewGroup viewGroup):


This function is automatically called when the list item view is ready to be displayed or
about to be displayed. In this function we set the layout for list items using
LayoutInflater class and then add the data to the views like ImageView, TextViewetc.
Below is the getView function’s example code with explanation included in which we
set the layout using LayoutInflater and then get the view’s id and implement them.
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
view = inflter.inflate(R.layout.activity_gridview, null);//set layout for displayi
ng items
ImageView icon = (ImageView) view.findViewById(R.id.icon);//get id for image view
icon.setImageResource(flags[i]);//set image of the item’s
return view;
}

3. getItem(int i):
This function is used to Get the data item associated with the specified position in the
data set to obtain the corresponding data of the specific location in the collection of
data items.
Below is the example code in which we returns the array list’s item according to
position.

@Override
public Object getItem(int i) {
return arrayList.get(i);
}

4. getItemId(int i):
As for the getItemId (int position), it returns the corresponding to the position item ID.
The function returns a long value of item position to the adapter.
Below is the code in which we returns the position.

@Override
public long getItemId(int i) {
return i;
}

BaseAdapter Example In Android Studio:


Example 1: Example of BaseAdapter for displaying Animal images in grids
using GridView.
In the below example we display animals images in the form of grids using custom
adapter to show the usage of BaseAdapter. Below is the final output and code with
explanation:

Step 1: Create a new project and name it BaseAdapterExample.


Step 2: Now open res -> layout -> activity_main.xml (or) main.xml and add following
code. Here we will create Gridview inside LinearLayout:

<?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="match_parent"
android:orientation="vertical">

<GridView
android:id="@+id/simpleGridView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:footerDividersEnabled="false"
android:numColumns="3" />
</LinearLayout>

Step 3: Create a new Activity activity_gridview.xml inside layout and add the below
code:

<?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="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/icon"
android:layout_width="100dp"
android:layout_height="100dp"
android:scaleType="fitXY"
android:layout_margin="5dp"
android:layout_gravity="center_horizontal" />
</LinearLayout>

Step 3: Now open app -> java -> package -> MainActivity.java and add the below code.
Make sure you have images saved in drawable folder with the names we have used or
else change the name based on the images present in your drawable folder.

package example.abhiandriod.baseadapterexample;

import android.app.Activity;
import android.os.Bundle;
import android.widget.GridView;

public class MainActivity extends Activity {

GridView simpleGrid;
int animals[] = {R.drawable.animal13, R.drawable.animal14, R.drawable.animal15, R.
drawable.animal16, R.drawable.animal17, R.drawable.animal18, R.drawable.animal15,
R.drawable.animal16, R.drawable.animal17};

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
simpleGrid = (GridView) findViewById(R.id.simpleGridView);
CustomAdapter customAdapter = new CustomAdapter(getApplicationContext(), animals);
simpleGrid.setAdapter(customAdapter);
}
}

Step 4: Create a new class CustomAdapter.java inside package and add the following
code
package example.abhiandriod.baseadapterexample; //Use your package

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

public class CustomAdapter extends BaseAdapter {


Context context;
int animals[];
LayoutInflater inflter;

public CustomAdapter(Context applicationContext, int[] animals) {


this.context = applicationContext;
this.animals = animals;
inflter = (LayoutInflater.from(applicationContext));
}

@Override
public int getCount() {
return animals.length;
}

@Override
public Object getItem(int i) {
return null;
}

@Override
public long getItemId(int i) {
return 0;
}

@Override
public View getView(int i, View view, ViewGroup viewGroup) {
view = inflter.inflate(R.layout.activity_gridview, null);
ImageView icon = (ImageView) view.findViewById(R.id.icon);
icon.setImageResource(animals[i]);
return view;
}
}

Output:
Now run the App in Emulator you will see Animals listed in Grids. So this is one use of
BaseAdapter in Gridview.

S-ar putea să vă placă și