我添加scrollview
在我activity_main.xml
和不再工作。 之前scrollview
并没有对三星S3,S4工作。 但它的工作对其他手机和平板电脑。
02-15 05:37:35.700: D/AndroidRuntime(936): Shutting down VM
02-15 05:37:35.700: W/dalvikvm(936): threadid=1: thread exiting with uncaught exception (group=0xb2a78ba8)
02-15 05:37:35.780: E/AndroidRuntime(936): FATAL EXCEPTION: main
02-15 05:37:35.780: E/AndroidRuntime(936): Process: com.oxygen.hayvansesleri, PID: 936
02-15 05:37:35.780: E/AndroidRuntime(936): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oxygen.hayvansesleri/com.oxygen.hayvansesleri.screencat}: android.view.InflateException: Binary XML file line #33: Error inflating class <unknown>
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.ActivityThread.access$800(ActivityThread.java:135)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.os.Handler.dispatchMessage(Handler.java:102)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.os.Looper.loop(Looper.java:136)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.ActivityThread.main(ActivityThread.java:5017)
02-15 05:37:35.780: E/AndroidRuntime(936): at java.lang.reflect.Method.invokeNative(Native Method)
02-15 05:37:35.780: E/AndroidRuntime(936): at java.lang.reflect.Method.invoke(Method.java:515)
02-15 05:37:35.780: E/AndroidRuntime(936): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-15 05:37:35.780: E/AndroidRuntime(936): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-15 05:37:35.780: E/AndroidRuntime(936): at dalvik.system.NativeStart.main(Native Method)
02-15 05:37:35.780: E/AndroidRuntime(936): Caused by: android.view.InflateException: Binary XML file line #33: Error inflating class <unknown>
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.createView(LayoutInflater.java:620)
02-15 05:37:35.780: E/AndroidRuntime(936): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:669)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:694)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
02-15 05:37:35.780: E/AndroidRuntime(936): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.Activity.setContentView(Activity.java:1929)
02-15 05:37:35.780: E/AndroidRuntime(936): at com.oxygen.hayvansesleri.screencat.onCreate(screencat.java:18)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.Activity.performCreate(Activity.java:5231)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
02-15 05:37:35.780: E/AndroidRuntime(936): ... 11 more
02-15 05:37:35.780: E/AndroidRuntime(936): Caused by: java.lang.reflect.InvocationTargetException
02-15 05:37:35.780: E/AndroidRuntime(936): at java.lang.reflect.Constructor.constructNative(Native Method)
02-15 05:37:35.780: E/AndroidRuntime(936): at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.view.LayoutInflater.createView(LayoutInflater.java:594)
02-15 05:37:35.780: E/AndroidRuntime(936): ... 24 more
02-15 05:37:35.780: E/AndroidRuntime(936): Caused by: java.lang.OutOfMemoryError
02-15 05:37:35.780: E/AndroidRuntime(936): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:422)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:840)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.content.res.Resources.loadDrawable(Resources.java:2110)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.content.res.TypedArray.getDrawable(TypedArray.java:602)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.widget.ImageView.<init>(ImageView.java:129)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.widget.ImageButton.<init>(ImageButton.java:87)
02-15 05:37:35.780: E/AndroidRuntime(936): at android.widget.ImageButton.<init>(ImageButton.java:83)
02-15 05:37:35.780: E/AndroidRuntime(936): ... 27 more
02-15 05:37:42.930: W/Ads(936): There was a problem getting an ad response. ErrorCode: 0
02-15 05:37:47.120: I/Process(936): Sending signal. PID: 936 SIG: 9
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AdView adView = (AdView) this.findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
final MediaPlayer click = MediaPlayer.create(MainActivity.this,
R.raw.click);
ImageButton catbutton = (ImageButton) findViewById(R.id.catbutton);
catbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screencat.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton dogbutton = (ImageButton) findViewById(R.id.dogbutton);
dogbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screendog.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton bearbutton = (ImageButton) findViewById(R.id.bearbutton);
bearbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screenbear.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton cowbutton = (ImageButton) findViewById(R.id.cowbutton);
cowbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screencow.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton duckbutton = (ImageButton) findViewById(R.id.duckbutton);
duckbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screenduck.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton hindibutton = (ImageButton) findViewById(R.id.hindibutton);
hindibutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screenhindi.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton lionbutton = (ImageButton) findViewById(R.id.lionbutton);
lionbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screenlion.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton tigerbutton = (ImageButton) findViewById(R.id.tigerbutton);
tigerbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screentiger.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton donkeybutton = (ImageButton) findViewById(R.id.donkeybutton);
donkeybutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this,
screendonkey.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton horsebutton = (ImageButton) findViewById(R.id.horsebutton);
horsebutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screenhorse.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
ImageButton goatbutton = (ImageButton) findViewById(R.id.goatbutton);
goatbutton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
click.start();
Intent intent = new Intent(MainActivity.this, screengoat.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}