So…I’m trying to fill in a TextView that extends the entire bottom half of the activity screen based upon the progress of the Red, Green, and Blue SeekBars on the top portion of the activity. The user can move any of the seekbars and the TextView that extends the entire width and length of the bottom half of the activity will be filled in with the correct RGB color scheme to match the 1-100 movement of all 3 SeekBars.
Any ideas on how to do this? I’ve googled the heck out of Android documentation and can’t find what I’m looking for. Even a link to give me an idea of what to do would be nice 🙂
*I should mention the code here runs perfectly fine on the android VM
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
public class MainActivity extends Activity implements OnSeekBarChangeListener
{
private SeekBar red;
private SeekBar green;
private SeekBar blue;
private TextView progress1;
private TextView progress2;
private TextView progress3;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
red = (SeekBar)findViewById(R.id.seekBar1);
red.setOnSeekBarChangeListener(this);
green = (SeekBar)findViewById(R.id.seekBar2);
green.setOnSeekBarChangeListener(this);
blue = (SeekBar)findViewById(R.id.seekBar3);
blue.setOnSeekBarChangeListener(this);
progress1 = (TextView)findViewById(R.id.textView2);
progress2 = (TextView)findViewById(R.id.textView4);
progress3 = (TextView)findViewById(R.id.textView6);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
{
switch(seekBar.getId())
{
case R.id.seekBar1:
progress1.setText(""+progress);
break;
case R.id.seekBar2:
progress2.setText(""+progress);
break;
case R.id.seekBar3:
progress3.setText(""+progress);
break;
}
}
@Override
public void onStartTrackingTouch(SeekBar arg0)
{
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar arg0)
{
// TODO Auto-generated method stub
}
}
Configure the SeekBars to have a max value of 255, then in your
onProgressChanged()useColor.argb()(docs):