何が起こっているのかわかりませんが、Galaxy s3 を使用してアプリをテストしています。画面の一部を取得してアプリの背景として並べて表示しているように見えますが、それ以降は何も読み込まれません。i.imgur.com/xLfnPtZ.png
次の奇妙な問題は、修正する必要があるかどうかさえわからないことですが、ほとんどの場合、アプリを実行すると、
09-06 13:23:55.127: E/(21368):: 読み取り用にファイルを開けません
しかし、文字通り何も変更しない場合でも、そうでない場合があります。少し調べてみたところ、実際には何もしていないようで、Galaxy S3に固有のものであるため、無視するように誰かが言いました.
とにかく、この時点での私の主な問題は、背景がめちゃくちゃになっていて、テキストやボタンなどが読み込まれていないことです.
UpdatePrices.java
package com.example.eveminingcalculator;
import com.example.eveminingcalculator.util.SystemUiHider;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
/**
* An example full-screen activity that shows and hides the system UI (i.e.
* status bar and navigation/system bar) with user interaction.
*
* @see SystemUiHider
*/
public class UpdatePrices extends Activity {
/**
* Whether or not the system UI should be auto-hidden after
* {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
*/
private static final boolean AUTO_HIDE = true;
/**
* If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
* user interaction before hiding the system UI.
*/
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
/**
* If set, will toggle the system UI visibility upon interaction. Otherwise,
* will show the system UI visibility upon interaction.
*/
private static final boolean TOGGLE_ON_CLICK = true;
/**
* The flags to pass to {@link SystemUiHider#getInstance}.
*/
private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;
/**
* The instance of the {@link SystemUiHider} for this activity.
*/
private SystemUiHider mSystemUiHider;
protected void onCreate(Bundle savedInstanceState, ArrayAdapter<CharSequence> Adapter) {
setContentView(R.layout.activity_update_prices);
final View controlsView = findViewById(R.id.CalcButtonLayout);
final View contentView = findViewById(R.id.UpdatePrices);
// Set up an instance of SystemUiHider to control the system UI for
// this activity.
mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS);
mSystemUiHider.setup();
mSystemUiHider
.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
// Cached values.
int mControlsHeight;
int mShortAnimTime;
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void onVisibilityChange(boolean visible) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
// If the ViewPropertyAnimator API is available
// (Honeycomb MR2 and later), use it to animate the
// in-layout UI controls at the bottom of the
// screen.
if (mControlsHeight == 0) {
mControlsHeight = controlsView.getHeight();
}
if (mShortAnimTime == 0) {
mShortAnimTime = getResources().getInteger(
android.R.integer.config_shortAnimTime);
}
controlsView.animate()
.translationY(visible ? 0 : mControlsHeight)
.setDuration(mShortAnimTime);
} else {
// If the ViewPropertyAnimator APIs aren't
// available, simply show or hide the in-layout UI
// controls.
controlsView.setVisibility(visible ? View.VISIBLE : View.GONE);
}
if (visible && AUTO_HIDE) {
// Schedule a hide().
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
}
});
// Set up the user interaction to manually show or hide the system UI.
contentView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (TOGGLE_ON_CLICK) {
mSystemUiHider.toggle();
} else {
mSystemUiHider.show();
}
}
});
// Upon interacting with UI controls, delay any scheduled hide()
// operations to prevent the jarring behavior of controls going away
// while interacting with the UI.
Spinner ShipSpinner = (Spinner) findViewById(R.id.spinnerShips);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.Ships, R.layout.spinner_layout);
adapter.setDropDownViewResource(R.layout.spinner_layout);
ShipSpinner.setAdapter(adapter);
Spinner TurretSpinner = (Spinner) findViewById(R.id.spinnerTurrets);
ArrayAdapter<CharSequence> adapter2 = ArrayAdapter.createFromResource(this,
R.array.Turrets, R.layout.spinner_layout);
adapter2.setDropDownViewResource(R.layout.spinner_layout);
TurretSpinner.setAdapter(adapter2);
Spinner TurretNumSpinner = (Spinner) findViewById(R.id.spinnerTurretNumber);
ArrayAdapter<CharSequence> adapter3 = ArrayAdapter.createFromResource(this,
R.array.NumTurrets, R.layout.spinner_layout);
adapter3.setDropDownViewResource(R.layout.spinner_layout);
TurretNumSpinner.setAdapter(adapter3);
Spinner UpgradesSpinner = (Spinner) findViewById(R.id.spinnerUpgrades);
ArrayAdapter<CharSequence> adapter4 = ArrayAdapter.createFromResource(this,
R.array.Upgrades, R.layout.spinner_layout);
adapter4.setDropDownViewResource(R.layout.spinner_layout);
UpgradesSpinner.setAdapter(adapter4);
Spinner UpgradesNumSpinner = (Spinner) findViewById(R.id.spinnerUpgradesNum);
ArrayAdapter<CharSequence> adapter5 = ArrayAdapter.createFromResource(this,
R.array.NumUpgrades, R.layout.spinner_layout);
adapter5.setDropDownViewResource(R.layout.spinner_layout);
UpgradesNumSpinner.setAdapter(adapter5);
Spinner ImplantSpinner = (Spinner) findViewById(R.id.spinnerImplant);
ArrayAdapter<CharSequence> adapter6 = ArrayAdapter.createFromResource(this,
R.array.Implants, R.layout.spinner_layout);
adapter6.setDropDownViewResource(R.layout.spinner_layout);
ImplantSpinner.setAdapter(adapter6);
Spinner ShipSkillSpinner = (Spinner) findViewById(R.id.spinnerShipSkill);
ArrayAdapter<CharSequence> adapter7 = ArrayAdapter.createFromResource(this,
R.array.SkillLevel, R.layout.spinner_layout);
adapter7.setDropDownViewResource(R.layout.spinner_layout);
ShipSkillSpinner.setAdapter(adapter7);
Spinner MiningSkillSpinner = (Spinner) findViewById(R.id.spinnerMiningSkill);
ArrayAdapter<CharSequence> adapter8 = ArrayAdapter.createFromResource(this,
R.array.SkillLevel, R.layout.spinner_layout);
adapter8.setDropDownViewResource(R.layout.spinner_layout);
MiningSkillSpinner.setAdapter(adapter8);
Spinner AstroSkillSpinner = (Spinner) findViewById(R.id.spinnerAstroSkill);
ArrayAdapter<CharSequence> adapter9 = ArrayAdapter.createFromResource(this,
R.array.SkillLevel, R.layout.spinner_layout);
adapter9.setDropDownViewResource(R.layout.spinner_layout);
AstroSkillSpinner.setAdapter(adapter9);
Spinner IceSkillSpinner = (Spinner) findViewById(R.id.spinnerIceHarvSkill);
ArrayAdapter<CharSequence> adapter10 = ArrayAdapter.createFromResource(this,
R.array.SkillLevel, R.layout.spinner_layout);
adapter10.setDropDownViewResource(R.layout.spinner_layout);
IceSkillSpinner.setAdapter(adapter10);
Spinner DeepCoreSkillSpinner = (Spinner) findViewById(R.id.spinnerDeepCoreSkill);
ArrayAdapter<CharSequence> adapter11 = ArrayAdapter.createFromResource(this,
R.array.SkillLevel, R.layout.spinner_layout);
adapter11.setDropDownViewResource(R.layout.spinner_layout);
DeepCoreSkillSpinner.setAdapter(adapter11);
findViewById(R.id.buttonCalculateIPH).setOnTouchListener(mDelayHideTouchListener);
delayedHide(100);
}
/**
* Touch listener to use for in-layout UI controls to delay hiding the
* system UI. This is to prevent the jarring behavior of controls going away
* while interacting with activity UI.
*/
View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (AUTO_HIDE) {
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
return false;
}
};
Handler mHideHandler = new Handler();
Runnable mHideRunnable = new Runnable() {
@Override
public void run() {
mSystemUiHider.hide();
}
};
/**
* Schedules a call to hide() in [delay] milliseconds, canceling any
* previously scheduled calls.
*/
private void delayedHide(int delayMillis) {
mHideHandler.removeCallbacks(mHideRunnable);
mHideHandler.postDelayed(mHideRunnable, delayMillis);
}
}
layout_update_prices.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/UpdatePrices"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#a33333"
android:visibility="visible"
tools:context=".UpdatePrices" >
<!--
The primary full-screen view. This can be replaced with whatever view
is needed to present your content, e.g. VideoView, SurfaceView,
TextureView, etc.
-->
<!--
This FrameLayout insets its children based on system windows using
android:fitsSystemWindows.
-->
<LinearLayout
android:id="@+id/CalcButtonLayout"
style="?buttonBarStyle"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_gravity="bottom|center_horizontal"
android:background="@color/black_overlay"
android:orientation="horizontal" >
<Button
android:id="@+id/buttonCalculateIPH"
style="?buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/calc_iph" />
</LinearLayout>
<TextView
android:id="@+id/textRegionSelect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="@string/region_select"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/RegionSelection"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:orientation="horizontal"
android:paddingLeft="20dp">
<RadioButton
android:id="@+id/radioJita"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<RadioButton
android:id="@+id/radioAmarr"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<RadioButton
android:id="@+id/radioDodixie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<RadioButton
android:id="@+id/radioRens"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<RadioButton
android:id="@+id/radioHek"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
</RadioGroup>
<TextView
android:id="@+id/textRegions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="80dp"
android:text="@string/systems"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="120dp"
android:text="@string/settings"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<TextView
android:id="@+id/textSecLevelSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="150dp"
android:paddingLeft="8dp"
android:text="@string/ore_sec"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/OreSecLevels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="170dp">
<CheckBox
android:id="@+id/checkHighSec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/hsec"
android:textSize="13sp" />
<CheckBox
android:id="@+id/checkLowSec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/lsec"
android:textSize="13sp" />
<CheckBox
android:id="@+id/checkNullSec"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/nsec"
android:textSize="13sp" />
</RadioGroup>
<TextView
android:id="@+id/textShipSkillsSettings"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="150dp"
android:paddingRight="8dp"
android:text="@string/ship_setup"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<EditText
android:id="@+id/editTurret"
android:layout_width="32dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="60dp"
android:layout_marginTop="175dp"
android:ems="10"
android:inputType="numberDecimal"
android:textSize="16sp">
<requestFocus
android:layout_width="wrap_content" />
</EditText>
<TextView
android:id="@+id/textm3ps"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="175dp"
android:paddingRight="8dp"
android:text="@string/m3s"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<LinearLayout
android:id="@+id/ShipSetupTitles"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="120dp"
android:layout_marginTop="175dp"
android:orientation="vertical">
<TextView
android:id="@+id/textDrones"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:text="@string/drones"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/textShip"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:paddingTop="8dp"
android:text="@string/ship"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/textTurrets"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:paddingTop="8dp"
android:text="@string/turrets"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/textUpgrades"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:paddingTop="8dp"
android:text="@string/upgrades"
android:textColor="#ffffff"
android:textSize="16sp" />
<TextView
android:id="@+id/textImplant"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:paddingTop="8dp"
android:text="@string/implant"
android:textColor="#ffffff"
android:textSize="16sp" />
</LinearLayout>
<Spinner
android:id="@+id/spinnerShips"
android:layout_width="105dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="8dp"
android:layout_marginTop="200dp"
android:entries="@array/Ships"
android:textAlignment="textStart"
tools:listitem="@layout/spinner_layout" />
<Spinner
android:id="@+id/spinnerTurretNumber"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="90dp"
android:layout_marginTop="229dp"
tools:listitem="@layout/spinner_layout" />
<Spinner
android:id="@+id/spinnerTurrets"
android:layout_width="75dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="8dp"
android:layout_marginTop="228dp"
android:entries="@array/Turrets"
tools:listitem="@layout/spinner_layout" />
<Spinner
android:id="@+id/spinnerUpgradesNum"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="90dp"
android:layout_marginTop="257dp"
android:entries="@array/NumUpgrades"
tools:listitem="@layout/spinner_layout" />
<Spinner
android:id="@+id/spinnerUpgrades"
android:layout_width="75dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="8dp"
android:layout_marginTop="257dp"
android:entries="@array/Upgrades"
tools:listitem="@layout/spinner_layout" />
<Spinner
android:id="@+id/spinnerImplant"
android:layout_width="105dp"
android:layout_height="22dp"
android:layout_gravity="right"
android:layout_marginRight="8dp"
android:layout_marginTop="283dp"
android:entries="@array/Implants"
tools:listitem="@layout/spinner_layout" />
<TextView
android:id="@+id/textSkills"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="315dp"
android:paddingLeft="8dp"
android:text="@string/skills"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/SkillLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginTop="362dp">
<TextView
android:id="@+id/textShipSkill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ship"
android:textColor="#ffffff"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinnerShipSkill"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="8dp"
android:entries="@array/SkillLevel"
tools:listitem="@layout/spinner_layout" />
<TextView
android:id="@+id/textMiningSkill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/mining_skill"
android:textColor="#ffffff"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinnerMiningSkill"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="8dp"
android:entries="@array/SkillLevel"
tools:listitem="@layout/spinner_layout" />
<TextView
android:id="@+id/textAstroSkill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/astro_skill"
android:textColor="#ffffff"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinnerAstroSkill"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="8dp"
android:entries="@array/SkillLevel"
tools:listitem="@layout/spinner_layout" />
</LinearLayout>
<LinearLayout
android:id="@+id/SkillLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="388dp">
<TextView
android:id="@+id/textIceHarvSkill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/iceharv_skill"
android:textColor="#ffffff"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinnerIceHarvSkill"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="8dp"
android:entries="@array/SkillLevel"
tools:listitem="@layout/spinner_layout" />
<TextView
android:id="@+id/textDeepCoreSkill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/deepcore_skill"
android:textColor="#ffffff"
android:textSize="16sp" />
<Spinner
android:id="@+id/spinnerDeepCoreSkill"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="8dp"
android:entries="@array/SkillLevel"
tools:listitem="@layout/spinner_layout" />
</LinearLayout>
<Button
android:id="@+id/buttonLoadAPI"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="334dp"
android:text="@string/loadapi"
android:textSize="13sp" />
</FrameLayout>
Android Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.eveminingcalculator"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".UpdatePrices"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:theme="@style/FullscreenTheme" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".APISettings" android:screenOrientation="portrait"></activity>
</application>
</manifest>