Basic design syntax for android studio mobile app programming with example add direct library dependencies

Tech Solution, Tutorial 0 Comments

Basic design syntax for android studio mobile app programming with example How to add direct library dependencies in android studio build.gradle(:app) file How to set alignment tutorial all Text button set in single line design.

How to add direct library dependencies in android studio build.gradle(:app) file

First Go to build.gradle(:app) file
Go to File option show on top side
Go to project structure
Click in dependencies option
Click on + sign
Click on library dependencies and now enter library dependencies name
for eg cardview used for design purpose and click on search and ok

Solve this error this operation requires the library com.android support.design

 

Difference between linear layout and relative layout in android studio

relative layout:

No more used relative layout mostly used linear linearlayout in android studio

linear linearlayout:

linear linearlayout depends on orientation vertical and horizontal, linear linearlayout work like HTML div

horizontal Like

1, 2, 3, ,4

vertical Lile

1,

2,

3,

4

Basic design syntax for android studio mobile app programming with example. Basic syntax design for android studio programming mobile app

  1. in case LinearLayout work like div, weight used automatic
    width set according to required and set in one alignment,
    single line
  2. only wrap_content used in height,width so button and
    linearlayout set according to need
  3. in case height,width set in fix in TextView using LinearLayout match_parent, wrap_content
  4. in case image height,width set in fix and alignment used marginLeft using LinearLayout match_parent, wrap_content design syntax for android studio mobile app
  5. in case used ScrollView, LinearLayout image height,width set in fix center, TextView set marginTop


write code

 

 

 


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:orientation="vertical"
android:padding="10dp"
android:background="#E6F4F7"
tools:context="menu">

<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:textSize="20sp"
android:paddingTop="2dp"
android:hint="enter"
/>

<!--in case LinearLayout work like div, weight used automatic
width set according to required and set in one alignment,
single line-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="button"/>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="button"/>
</LinearLayout>
<!--only wrap_content used in height,width so button and
linearlayout set according to need-->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center">

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"/>
</LinearLayout>
<!--only wrap_content used in height,width so button and
linearlayout set according to need-->

<!--in case height,width set in fix -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="110dp"
android:layout_height="20dp"
android:text="Gender Texttype" />
<TextView
android:layout_width="110dp"
android:layout_height="20dp"
android:paddingRight="8dp"
android:text="Gender Texttype"
/>
</LinearLayout>
<!--in case height,width set in fix -->

<!--in case image height,width set in fix and alignment
used marginLeft -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/studyiconmobile"
/>
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginLeft="20dp"
android:src="@drawable/studyiconmobile"
/>
<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:layout_marginLeft="20dp"
android:src="@drawable/studyiconmobile"
/>

</LinearLayout>
<!--in case image height,width set in fix and alignment
used marginLeft -->

<!--in case used ScrollView, LinearLayout image height,width
set in fix center, TextView set marginTop -->
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!--android:gravity="center"-->

<ImageView
android:layout_width="90dp"
android:layout_height="90dp"
android:src="@drawable/studyiconmobile"
android:layout_gravity="center"

/>

<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
android:paddingLeft="40dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>
<TextView
android:layout_width="100dp"
android:layout_height="20dp"
android:text="Gender Texttype"
android:layout_marginTop="20dp"
/>

</LinearLayout>

</ScrollView>

<!--in case used ScrollView, LinearLayout image height,width
set in fix center, TextView set marginTop -->

</LinearLayout>

Click and download source code

Basic design syntax for android studio mobile app programming

 

Basic design syntax for android studio mobile app programming with example How to add direct library dependencies in android studio build.gradle(:app) file How to set alignment tutorial all Text button set in single line design.