Add DEV4.5/exo1_controle
This commit is contained in:
47
DEV4.5/exo1_controle
Normal file
47
DEV4.5/exo1_controle
Normal file
@@ -0,0 +1,47 @@
|
||||
package icom.example.q1_amyti;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
// Couleurs RGB explicites
|
||||
View zoneBleue = findViewById(R.id.zone_bleue);
|
||||
zoneBleue.setBackgroundColor(Color.rgb(170, 204, 238));
|
||||
|
||||
View zoneRose = findViewById(R.id.zone_rose);
|
||||
zoneRose.setBackgroundColor(Color.rgb(255, 170, 204));
|
||||
}
|
||||
}
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/rootLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="30dp">
|
||||
|
||||
<View
|
||||
android:id="@+id/zone_bleue"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true" />
|
||||
|
||||
<View
|
||||
android:id="@+id/zone_rose"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_toEndOf="@id/zone_bleue"
|
||||
android:layout_alignTop="@id/zone_bleue"
|
||||
android:layout_marginStart="30dp" />
|
||||
</RelativeLayout>
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user