.


:




:

































 

 

 

 


Android-




Project : app Gradle Scripts. app - , .. , .

app. : manifest, java, res.

manifest. AndroidManifest.xml. Gradle.

, , - . . , , . AndroidManifest.xml , Android-.

java. - . . MainActivity. .

res. res , .

drawable , .

layout xml-, . activity_main.xml, .

menu - , , menu_main.xml, .

values - , , , , .

. activity_main.xml. - Design Text.

Text.

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

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

android:paddingBottom="@dimen/activity_vertical_margin"

tools:context=".MainActivity">

 

<TextView

android:text="@string/hello_world"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

 

</RelativeLayout>

, android:text="@string/hello_world" android:text="Hello World!". , Hello World!, . , , , . , , , 16dp. .. , , @string/hello_world. Ctrl + - () .

XML-. RelativeLayout, TextView, . , hello_world. res/values/strings.xml.

Java- (MainActivity.java)

 

package ru.alexanderklimov.helloworld;

 

import android.app.Activity;

import android.os.Bundle;

import android.view.Menu;

import android.view.MenuItem;

 

public class MainActivity extends Activity {

 

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

}

 

@Override

public boolean onCreateOptionsMenu(Menu menu) {

 

// Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main, menu);

return true;

}

 

@Override

public boolean onOptionsItemSelected(MenuItem item) {

// Handle action bar item clicks here. The action bar will

// automatically handle clicks on the Home/Up button, so long

// as you specify a parent activity in AndroidManifest.xml.

int id = item.getItemId();

if (id == R.id.action_settings) {

return true;

}

return super.onOptionsItemSelected(item);

}

}

, MainActivity java ( Java). - (Package Name). . . . , ( Unused import statement) .

, (extends) Activity. . , ActionBarActivity, . , Android 4.1. , Android 4, , Android . ActionBarActivity . Activity. , . . , .

onCreate() , . .

super.onCreate(savedInstanceState); , . , .

setContentView(R.layout.activity_main); . setContentView(int) . res/layout. activity_main.xml. cat.xml . :

 

setContentView(R.layout.cat);

, . . , Settings.





:


: 2016-11-24; !; : 626 |


:

:

.
==> ...

1462 - | 1446 -


© 2015-2024 lektsii.org - -

: 0.018 .