Question

In: Computer Science

Create and display an XML file in Android studio that has -One edittext box the does...

Create and display an XML file in Android studio that has

-One edittext box the does NOT use material design

-One edittext box that DOES use material design

Provide a “hint” for each, and make sure the string that comprises the hint is referenced from the strings.xml file.

Observe the differences in how the hints are displayed.

Here is sample code for a material design editText:

<android.support.design.widget.TextInputLayout
       
android:id="@+id/input_layout_price1Text"
       
android:layout_width="80dp"
       
android:layout_height="40dp"            >

    <EditText
           
android:id="@+id/price1Text"
           
android:importantForAutofill="no"
           
tools:targetApi="o"
           
android:layout_width="wrap_content"
           
android:layout_height="wrap_content"
           
android:ems="6"
           
android:inputType="numberDecimal"
           
android:hint="@string/hint_text" />
</android.support.design.widget.TextInputLayout>

It requires this to be added to the build.gradle Module:app

implementation 'com.android.support:design:28.0.0'

Take a screenshot, Make sure the screenshot clearly shows the two different ways that the hints are displayed.

Solutions

Expert Solution

actyivity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
    tools:context=".MainActivity">

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/input_layout_price1Text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="16dp"
        android:layout_marginEnd="8dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <com.google.android.material.textfield.TextInputEditText
            android:id="@+id/price1Text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:importantForAutofill="no"
            android:ems="6"
            tools:targetApi="o"
            android:hint="@string/material_edittext_hint"
            android:padding="20dp" />

    </com.google.android.material.textfield.TextInputLayout>

    <EditText
        android:id="@+id/price2Text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="8dp"
        android:layout_marginTop="32dp"
        android:layout_marginEnd="8dp"
        android:hint="@string/normal_edittext_hint"
        android:importantForAutofill="no"
        android:inputType="numberDecimal"
        android:padding="20dp"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/input_layout_price1Text" />


</androidx.constraintlayout.widget.ConstraintLayout>

****************************************************************** SCREENSHOT *********************************************************


Related Solutions

Android Studio Code: Provide a working android studio code i.e java and xml code for the...
Android Studio Code: Provide a working android studio code i.e java and xml code for the activity below: Develop an application that is capable to turn pages back and forth. Detailed Instructions: For the main activity, create a layout that represents a fictitious title and author. The activity should include a clickable button on the bottom right that allows you to go forward to the next activity. The next activity will simply be an image above simple text that can...
Using Android Studio, create a one java android app that has 4 buttons:- Change Color Button...
Using Android Studio, create a one java android app that has 4 buttons:- Change Color Button - When the Change Color button is clicked, it changes the current activity background to a randomly selected color Speak Button - When the Speak button is clicked, it opens a new activity named SpeakActivity. On the SpeakActivity there are three controls: EditText, Button (Speak) and Button (Back). The Speak button uses the Text to Speech service to say the text entered in EditText....
How to get the vote count to display in another activity? This is for android studio...
How to get the vote count to display in another activity? This is for android studio with Java codes. private int yesVoteCount = 0;     private int noVoteCount = 0;     private int resetVotes = 0;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);         // Use res ID to retrieve inflated objects and assign to variables         mYesButton = findViewById(R.id.yes_button);         mNoButton = findViewById(R.id.no_button);         mResetButton = findViewById(R.id.reset_button);         mSurveyQuestion = findViewById(R.id.survey_question);         mYesCount =...
1. Create one XML data file and one DTD file for the entire data set (using...
1. Create one XML data file and one DTD file for the entire data set (using a subset of SQL assignment – see below). [Use of ID and IDREF are not required.] 2. Write and execute XML statements for the following two queries: Q1. Find the name of an employee who lives in Lincoln and works in Omaha. Q2. Find salaries of employees who live in the same cities as the companies for which they work. [You can replace one...
android studio -Starting with a basic activity, create a new Java class (use File->New->Java class) called...
android studio -Starting with a basic activity, create a new Java class (use File->New->Java class) called DataBaseManager as in Lecture 5 and create a database table in SQLite, called StudentInfo. The fields for the StudentInfo table include StudentID, FirstName, LastName, YearOfBirth and Gender. Include functions for adding a row to the table and for retrieving all rows, similar to that shown in lecture 5. No user interface is required for this question, t -Continuing from , follow the example in...
Create a Scorekeeper app in android studio by using java language - Layouts | Widgets Create...
Create a Scorekeeper app in android studio by using java language - Layouts | Widgets Create the layout for your score keeping app. The app should have: Two team names (TextViews) Two scores (TextViews) Buttons to increase/ decrease the scores An amount to change the score by (RadioButtons) You must have at least two score options The scores can be changed by anything you want American football: 1, 2, 3, 6 Basketball: 1, 2, 3 Freestyle wrestling: 1, 2, 3,...
IN ANDROID STUDIO, you will create a mortgage calculator appthat allows the user to enter...
IN ANDROID STUDIO, you will create a mortgage calculator app that allows the user to enter a purchase price, down-payment amount, and an interest rate.Based on these values, the app should calculate the loan amount (purchase price minus down payment) and display the monthly payment for 10, 20, and 30-year loans.Allow the user to select a custom loan duration (in years) by using a SeekBar and display the monthly payment for that custom loan duration.Assignment deliverables (all in a ZIP...
Android Studio. Java. Please create an application that -> An activity that allows user to enter...
Android Studio. Java. Please create an application that -> An activity that allows user to enter name, gender, date of birth, state of residence (selected from a pre-defined list: CA, AZ, NV, OR), email address and favorite website. This activity has a button "Show Data" that displays detail entered
3.1. Create an XML schema to validate the following XML file. <?xml version="1.0" encoding="utf-8"?> <root> <whats>Everything</whats>...
3.1. Create an XML schema to validate the following XML file. <?xml version="1.0" encoding="utf-8"?> <root> <whats>Everything</whats> <up>Is</up> <doc>Fine</doc> </root> Schema starter: <xsd:schema xmlns:xsd=""> <xsd:element name="root" type="rootType" /> <xsd:complexType name="rootType">     <xsd:sequence>       <xsd:element name="" type="" minOccurs="1" />       <xsd:element name="” type="" minOccurs="1" />       <xsd:element name="" type="" minOccurs="1" />     </xsd:sequence> </xsd:complexType> </xsd:schema> 3.2. Use your schema to validate the XML file.                     3.2.1. You can use Visual Studio or online utilities to apply the schema to the XML file....
Create a mobile application using Android studio, for cinema tickets reservation. The application will be used...
Create a mobile application using Android studio, for cinema tickets reservation. The application will be used by the customers to book cinema tickets. Only users of 15 years old and above are allowed to book cinema tickets for a particular film. The user can book more than one ticket where ticket prices vary between 20 and 50 AED. Your app contains tree Activities. The first activity is a launching activity containing a logo and a button start. When the user...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT