I am working on the CreateMultiPaneStockChartFragment example and I want to catch the event when user check/unchecks checkbox in the legend so I can hide/show the yAxis of the series.
Let's say user unchecks RSI series. The series hide automatically, but a big empty space is now there. In my case I want to completely hide the area and other charts should become bigger to fill the empty space.
I don't know if this is right approach;
I modified RightAlignedOuterVerticallyStackedYAxisLayoutStrategy so that I can set different axis heights. Now I need to catch checkbox events - how?
Have you tried the approach suggested in this question from SciChart forums? You'll need to customize content of OnClickListener for checkBox:
checkBox.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
IRenderableSeries renderableSeries = seriesInfo.renderableSeries;
renderableSeries.setIsVisible(((CheckBox) view).isChecked());
renderableSeries.invalidateElement();
}
});
To get access to chart instance ( and then from it to axis ) from listener you can use next code:
BaseRenderableSeries renderableSeries = (BaseRenderableSeries) seriesInfo.renderableSeries;
final ISciChartSurface parentSurface = renderableSeries.getParentSurface();
Hope this will help you!
Related
I made a Ctrl+F search box with next ocurrence button, when i click next it scroll to next word, but the word is out of screen , if i scroll a few pixels down , you are able to see it.
so after the method find next is called i would like to scroll a little more so the highlighted word is visible.
mFindNextButton = (ImageButton) findViewById(R.id.find_next);
mFindNextButton.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
mCurrentWebView.findNext(true);
//scroll a little more()
}
});
Maybe something like this:
scrollView.scrollTo(0, scrollView.getScrollY()+10); // Scroll down 10 more pixels
I use Achartengine 1.1.0. Is posible to setClickListener() on x label's view? For exemple when i click "Dec" i want to show a toast: "December =14240"
There is not any direct method to get the touch event on labels.
But by getting the touched position and implementing this, you can achieve what u want.
You will need to check that position touched is of ur label.
Then do what u want.
To get the touched position see this
aChartEngine: getting coordinates of any point on the graph area
Also u can use
mChartView.setOnClickListener(new View.OnClickListener(){
public void onClick(View v)
{
System.out.println("X :" + mChartView.toRealPoint(0)[0]);
System.out.println("Y :" + mChartView.toRealPoint(0)[1]);
}
});
and check x.y values for labels positions.
I'm Making simple app for project
That App contains lot of text so i want,
"when a button is pressed, text should Change in same layout"
like PowerPoint slide.
I want change text only not scroll.
Now i made my app, have lots of Windows or Layouts.
It is not looking good, too much layout in simple app so please help me .
Thanks in advance
Doing this is very easy, I will quickly walk you through the Algorithm:
Set a class level variable called as FLAG initialize it to 1.
Let us assume that FLAG = 1 will represent the first slide. FLAG = 2 the second slide and so on.
Now in your button click you can use a switch case or an if else condition, based on the value of the flag display the relevant text in textview.
Once done, increment the flag, for the next set of sentence(s).
Class level:
int FLAG = 1;
onCreate:
Initialize your textView:
TextView mtv = (TextView)findViewById(R.id.yourid);
Set a button click listener:
private View.OnClickListener slides = new View.OnClickListener() {
#Override
public void onClick(View v) {
if(FLAG ==1)
mtv.setText("First slide");
else if(FLAG ==2)
mtv.setText("Second Slide");
//and so on...
FLAG = FLAG+1;//increment flag
}
};
Hi i have two textViews that i initially set its visibility to gone then animate in and become visible. now i want to make the invisible again but for some reason they're still showing on screen does anyone no why?
in my onCreate() i make the view gone
register = (TextView)findViewById(R.id.register);
register.setVisibility(View.GONE);
forgotpassword = (TextView)findViewById(R.id.forgotpw);
forgotpassword.setVisibility(View.GONE);
then later on i make it visible
public void run()
{
animations();
loginForm.setVisibility(View.VISIBLE);
register.setVisibility(View.VISIBLE);
forgotpassword.setVisibility(View.VISIBLE);
}
and then when a user presses a button i want the text views to become invisible so that they retain their layout but they stay visible on screen
signInBtn = (Button) findViewById(R.id.signin);
signInBtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
signInProcess();
}
});
public void signInProcess() {
register.setVisibility(View.INVISIBLE);
forgotpassword.setVisibility(View.INVISIBLE);
setuploader.setVisibility(View.VISIBLE);
}
In Android when you animate something, It's just drawn somewhere else. The actual element is not moved. So when you animate signInBtn it's drawn somewhere else, but the actual button is not moved from the original position. So when you click the button the click handler is not called.
To avoid this set fillAfter = True in your animation so the button will actually get moved at the end of your animation.
Also, after animating a view in Android make sure you call View.clearAnimation() before trying to change its visibility.
I want to create an application based on quiz which consists of 14 questions.
Can anyone tell me how do I need to go from one question to another by clicking on next button.If I use an Intent then I am afraid that I will be creating 14 Activities :(
I don't think that is the programmatic procedure too.
You can stay in the same Activity and keep track of the question.
You might want to use a TextSwitcher to add a fade in/fade out animation when swapping the question's text.
You could have the button click just update the questions text to be the next question.
nextButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
questionTextView.setText(questionTwo);
}
});
#Vivek you can use view flipper
this might help you
http://www.bogotobogo.com/Android/android9TabWidgetFlipper.html#SlidingDrawer
http://www.warriorpoint.com/blog/2009/05/29/android-switching-screens-by-dragging-over-the-touch-screen/
Change the text of your textviews where the questions are.
#Override
protected void onCreate(Bundle savedInstanceState) {
Button nextButton = (Button) findViewById(R.id.yourButtonId);
TextView questionTextView = (TextView) findViewById(R.id.yourTextViewId);
nextButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
questionTextView.setText("Your Next Question");
}
});
}
A Fragment is a piece of an application's user interface or behavior that can be placed in an Activity.
Has its own lifecycle;
Receives its own input events;
Can be added or removed while the activity is running;
Believe me that is the best method. I have been introduced to fragments having an application with quotes. The list of the quotes in left and the quotes that were changing on left when an author have been selected.
I'm using android.widget.ViewFlipper that contains views where one view contains TextView (question) and "input control" for answer (selectboxes, date/time widget, radiogroup, etc).