سلام ببخشید این پست رو بالا میارم اما کارم ضروریه اگه کمکم کنید ممنون میشم
من کجای این پروژه اشتباه کردم؟صفحه اصلیم (main activity.xml)یه دکمه ای دارم بنام sdk که فایل جاوا و xml اونو ساختم که تو xml یک عکس دارم کدهای zoomcontrol دادم اما force close میده وقتی می خوام زوم کنم!!اسم عکسم هم a هستش
این صفحه sdk.xml من هستش اینم صفحه SDK.java هستش
اینم androidmainfest
اینم string
من کجای این پروژه اشتباه کردم؟صفحه اصلیم (main activity.xml)یه دکمه ای دارم بنام sdk که فایل جاوا و xml اونو ساختم که تو xml یک عکس دارم کدهای zoomcontrol دادم اما force close میده وقتی می خوام زوم کنم!!اسم عکسم هم a هستش
این صفحه sdk.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" >
<TextView
android:id="@+id/textView1"
android:textSize="18dp"
android:textColor="#4169E1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="40dp"
android:text="Static ZoomControls" />
<ZoomControls
android:id="@+id/zoomControls1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40dp" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/a" />
</RelativeLayout>
کد پیاچپی:
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ZoomControls;
public class SDK extends Activity {
ZoomControls zoom;
ImageView img;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sdk);
zoom = (ZoomControls) findViewById(R.id.zoomControls1);
img = (ImageView) findViewById(R.id.imageView1);
zoom.setOnZoomInClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
float x = img.getScaleX();
float y = img.getScaleY();
img.setScaleX((float) (x+1));
img.setScaleY((float) (y+1));
}
});
zoom.setOnZoomOutClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
float x = img.getScaleX();
float y = img.getScaleY();
img.setScaleX((float) (x-1));
img.setScaleY((float) (y-1));
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu. main, menu);
return true;
}
}
اینم androidmainfest
کد پیاچپی:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eclipse.program"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="22" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-******>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-******>
</activity>
<activity android:name="Moarefi"/>
<activity android:name="SDK"/>
</application>
</manifest>
اینم string
کد پیاچپی:
<string name="app_name">برنامه نویسی </string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="title_sdk">SDK</string>