Северный (Арктический) федеральный университет им. М.В. Ломоносова
Опубликован: 10.04.2014 | Доступ: свободный | Студентов: 6824 / 1221 | Длительность: 14:18:00
Специальности: Программист
Самостоятельная работа 3:

Основы разработки интерфейсов мобильных приложений

< Лекция 3 || Самостоятельная работа 3: 123456789 || Лекция 4 >

6.2.7 Листинги

1)

<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:paddingBottom="@dimen/activity_vertical_margin"
	android:paddingLeft="@dimen/activity_horizontal_margin"
	android:paddingRight="@dimen/activity_horizontal_margin"
	android:paddingTop="@dimen/activity_vertical_margin"
	tools:context=".MainActivity" 
	android:background="@drawable/background">

	<LinearLayout
		android:id="@+id/linear1"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_alignParentLeft="true"
		android:layout_alignParentRight="true"
		android:orientation="horizontal" >
		<EditText
			android:id="@+id/edit_message"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:ems="10"
			android:hint="@string/edit_message"
			android:textColor="#ffffff" >
			<requestFocus />
		</EditText>

		<Button
			android:id="@+id/button1"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:text="@string/button_send" 
		/>
	</LinearLayout>

	<FrameLayout
		android:id="@+id/imgview"
		android:layout_width="match_parent"
		android:layout_height="match_parent"
		android:layout_above="@+id/relative2"
		android:layout_below="@id/linear1" >
		<ImageView
			android:id="@+id/puppy"
			android:layout_width="wrap_content"
			android:layout_height="match_parent"
			android:src="@drawable/puppy" 
		/>
	</FrameLayout>

	<RelativeLayout
		android:id="@+id/relative2"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
		android:layout_alignLeft="@+id/imgview"
		android:layout_alignParentBottom="true"
		android:layout_alignRight="@+id/imgview" >
		<ImageButton
			android:id="@+id/imageButton2"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_alignParentRight="true"
			android:layout_alignParentTop="true"
			android:src="@drawable/dislike" 
		/>
		<ImageButton
			android:id="@+id/imageButton1"
			android:layout_width="wrap_content"
			android:layout_height="wrap_content"
			android:layout_alignParentLeft="true"
			android:layout_alignParentTop="true"
			android:src="@drawable/like" 
		/>
	</RelativeLayout>

</RelativeLayout>
        

2)

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

		<string name="app_name">RatingImages</string>
		<string name="action_settings">Settings</string>
		<string name="hello_world">Hello world!</string>
		<string name="edit_message">Enter your text here</string>
		<string name="button_send">Go!</string>

</resources> 
        

3)

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

<bitmap
	xmlns:android="http://schemas.android.com/apk/res/android" 
	android:src="@drawable/starring"
	android:tileMode="repeat" >

</bitmap>
        
< Лекция 3 || Самостоятельная работа 3: 123456789 || Лекция 4 >
Марат Нуриджанян
Марат Нуриджанян

Пример: Скачать среду можно с сайта для разработчиков Android (http://developer.android.com/sdk/index.html).

Там скачать можно только Android Studio

Владимир Каункин
Владимир Каункин

В самостоятельной работе 2 в примере решения задания некорректно загадывается число (в двух местах), выбирая случайное целое число из диапазона [0, 99] вместо [1, 100], как того требует условие. Кроме того, загадывание числа всё таки лучше вынести в отдельный метод, как мне кажется.