activity.main.xml
<?xml version="1.0" encoding="utf-8"?>
<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="com.example.user.assigment_2.MainActivity"
android:background="#fbf8f8"
android:clickable="true"
android:id="@+id/RL">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="RED"
android:id="@+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Green"
android:id="@+id/textView2"
android:layout_marginTop="45dp"
android:layout_below="@+id/textView"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Blue"
android:id="@+id/textView3"
android:layout_below="@+id/textView2"
android:layout_alignParentStart="true"
android:layout_marginTop="59dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/Rvalue"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:text="0" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/Gvalue"
android:layout_alignTop="@+id/textView2"
android:layout_alignEnd="@+id/Rvalue"
android:text="0" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="@+id/Bvalue"
android:layout_alignTop="@+id/textView3"
android:layout_alignEnd="@+id/Gvalue"
android:text="0" />
<SeekBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/Rseek"
android:layout_below="@+id/Bvalue"
android:layout_alignParentStart="true"
android:layout_marginTop="49dp"
android:max="255"
android:indeterminate="false" />
<SeekBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/Gseek"
android:layout_marginTop="43dp"
android:layout_below="@+id/Rseek"
android:layout_alignParentEnd="true"
android:max="255"
android:indeterminate="false" />
<SeekBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/Bseek"
android:layout_below="@+id/Gseek"
android:layout_alignParentStart="true"
android:layout_marginTop="45dp"
android:max="255"
android:indeterminate="false" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="OK"
android:id="@+id/button"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
Activity.main package com.example.user.assigment_2;Read more »
import android.graphics.Color;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
public class MainActivity extends AppCompatActivity {
private SeekBar rsb,gsb,bsb;
private EditText Rnum,Gnum,Bnum;
private Button BT;
private RelativeLayout mRelativeLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
rsb=(SeekBar)findViewById(R.id.Rseek);
gsb=(SeekBar)findViewById(R.id.Gseek);
bsb=(SeekBar)findViewById(R.id.Bseek);
Rnum=(EditText)findViewById(R.id.Rvalue);
Gnum=(EditText)findViewById(R.id.Gvalue);
Bnum=(EditText)findViewById(R.id.Bvalue);
BT=(Button)findViewById(R.id.button);
mRelativeLayout=(RelativeLayout)findViewById(R.id.RL);...