AchartEngine disable only zoomout button - android

I'm using AchartEngine to draw graphs,
is it possible to disable only the zoom out button ?
thanks.

You can disable the original zoom buttons with below code
mRenderer.setZoomButtonsVisible(false);
and write your own button just to zoom-in inside your xml file and do something like below:
ImageButton btnZoomIn= (ImageButton) findViewById(R.id.btnZoomIn);
btnZoomIn.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
mChartView.zoomIn();
}
});

Related

android zoom in button only with webview

I have a simple android webview app and I want to add zoom in button only,
I added the zoom in button in the graphical layout:
but how can I make it work in the java file ?
In your activity, add an on click listener to your button that zooms in the webview:
findViewById(R.id.zoom_in_btn).setOnClickListener(
new View.OnClickListener() {
#Override
public void onClick(View v)
{
webviewer.zoomIn();
}
});

cocos2d ccsprite in front or top of android xml layout

want to add CCSprite on button click of android xml layout , this CCSprite must be in front of that layout button. Please help me out
holder.buttonDonate.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
// ClanCastleDonateUI extends CCLayer and it contains CCSprite
ClanCastleDonateUI troopDonatePopup = new ClanCastleDonateUI(message2);
troopDonatePopup.setAnchorPoint(0.5f, 0.5f);
troopDonatePopup.setPosition(HowUtils.getScreenSize().x/2, HowUtils.getScreenSize().y/2);
troopDonatePopup.setVertexZ(50);
CCDirector.sharedDirector().getRunningScene().addChild(troopDonatePopup, 9999999);
}
});
Please be more specific. according to what i understand , do you need to change the button when clicked. or do you have to place a new sprite on the screen when a button is clicked.

hide one image and show other

I have two images(above, below) place on each other. I want to hide the part of the above image where user touchs. At the end above image will completely remove and below image completely become visible.
How will I achieve this thing in Android. I am really clueless. Please help
example:
button = (Button) findViewById(R.id.button);
leftButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v)
{
image.setVisibility(View.INVISIBLE); //to set the image as invisible
image.setVisibility(View.VISIBLE); // to set it back to visible
}
});
hope this will help you.

Change zoom controls in a MapView

I would like to change the predefined style of the zoom controls in my application to appear like the new zoom controls in the google maps application. See below:
How can I do it? I have been looking around and I haven't found anything.
Thanks in advance.
You should have four image drawables namely:
Zoom in (+) enable/disable
Zoom out (-) enable/disable
Put them in MapView layout an ImageView or Button with background image as the above drawables.
Then you should assign onClickListeners like:
zoomIn.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
mapView.getController.zoomIn()
checkzoom();
}
});
zoomOut.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
mapView.getController.zoomOut()
checkzoom();
}
});
public void checkzoom() {
if(mapView.getZoomLevel()==1) // dont know if 0 or 1, just wrote it
{
zoomOut.setEnabled(false);
// or u can change drawable and disable click
}
if(mapView.getZoomLevel()==18) {
zoomIn.setEnabled(false);
// or u can change drawable and disable click
}
}
EDIT:
I solved the problem this way: disabled built in zoom controls (setBuiltInZoomControls(false)), added my own buttons to UI and added handlers for click on button events.

change button image in android

I want to change the image of a button in my code. I found this can be done in xml:
please check this link
but the image will not stay on after I released the button. I want to click the button
and the button change to a new image. Can this be done?
in onClick method you need to change the Button's image, this way..
public void onClick(View v) {
if(v==buttonName){
buttonName.setBackgroundResource(R.drawable.imageName);
}
}
Assuming an ImageButton...
You can change the background image in an onClick listener, similar to the following:
myButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//set button image
myButton.setImageBitmap(myBitmapFile)
}
});

Categories

Resources