I must to compose screen by an template. There are 4 simple-text fields, 4 text input fields and 7 different buttons. At this moment I does't reached to buttons, becouse when I trying to Build my project, Android Studio gives out an next Warning :
Missing classes:
The following classes could not be found:
- Description (Fix Build Path, Edit XML)
- Desease (Fix Build Path, Edit XML)
- InputDescription (Fix Build Path, Edit XML)
- InputDesease (Fix Build Path, Edit XML)
- InputLocation (Fix Build Path, Edit XML)
- InputName (Fix Build Path, Edit XML)
- Location (Fix Build Path, Edit XML)
- Name (Fix Build Path, Edit XML)
I read articles about the same problem here, The following classes could not be found: android.support.v7.internal.app.WindowDecorActionBar As I understand, here I must to declare the right class. But I don't understand what I should do with this problem? Why A.S. says that my textViews are classes? 2 xml files are presented below: First is MainActivity, with all layouts , in second xml is actoinbar, where I want to centrilize my app name.
MainActivity 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="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginStart="16dp"
android:orientation="vertical"
tools:context="com.example.boris_veriga.home_screen.MainActivity">
<Name
android:id="@+id/person_Name"
tools:text="@string/textView_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="100dp" />
<InputName
android:id="@+id/inputName"
android:layout_width="wrap_content"
android:layout_height="16dp"
android:hint="@string/input_yourName"
android:inputType="textPersonName"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/person_Name" />
<Desease
android:id="@+id/person_Desease"
tools:text="@string/textView_desease"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="150dp" />
<InputDesease
android:id="@+id/inputDesease"
android:hint="@string/input_yourDesease"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/person_Desease"
android:inputType="textPersonName" />
<Location
android:id="@+id/person_Location"
tools:text="@string/textView_location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="200dp" />
<InputLocation
android:id="@+id/inputLocation"
android:hint="@string/input_yourLocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/person_Location"
android:inputType="textPersonName" />
<Description
android:id="@+id/person_Description"
tools:text="@string/textView_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginTop="250dp" />
<InputDescription
android:id="@+id/inputDescription"
android:hint="@string/input_yourDescription"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/person_Description"
android:inputType="textPersonName" />
</android.support.constraint.ConstraintLayout>
ActionBar - XML(I want to set app title in center):
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<ActionBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/app_name"
android:textStyle="bold"
android:textColor="#ffff"
android:textSize="24sp" />
</android.support.constraint.LinearLayout>
MainActivity - .java:
package com.example.boris_veriga.home_screen;
import android.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
getActionBar().setCustomView(R.layout.actionbar);
setContentView(R.layout.activity_main);
}
}
P.S.:Sory for my English and I'm new in Android. Thank'u!!!