- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我遇到一个问题,加载动画(5 个连续点从左向右移动)在 ICS 后设备中不起作用,但在 ICS 前设备中完美运行。我尝试在两者中复制调用动画的相同方法,但它似乎不起作用。
提前致谢,
阿曼尼·斯旺
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int version = android.os.Build.VERSION.SDK_INT;
tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
handler = new XmlParserHandlerFinal();
handler.setContext(this.getBaseContext());
getImpVariablesForQuery();
if (version < VERSION_CODES.ICE_CREAM_SANDWICH) {
try {
// updating layout initially has updating text with 1 dot in the
// xml
setContentView(R.layout.updating);
// This image view has the updating text to be progressively
// updated
// with dots addition
ImageView loading = (ImageView) findViewById(R.id.loading_empty1);
// Set updating button to drawable animation
loading.setBackgroundResource(R.drawable.updating1);
loadingAnimation = (AnimationDrawable) loading.getBackground();
ImageView loading2 = (ImageView) findViewById(R.id.loading_empty2);
// Set updating button to drawable animation
loading2.setBackgroundResource(R.drawable.updating2);
loadingAnimation = (AnimationDrawable) loading2.getBackground();
tasks.execute("https://dl.dropboxusercontent.com/u/31771876/GetPhoneSettings-ST-rsp-eng.xml");
if (tasks.get() != null) {
stream = tasks.getInputStream();
Log.v("CfA", "here");
} else if (tasks.get() == null) {
setContentView(R.layout.error);
// finish();
// finish();
}
handler.getQueryResponse(stream);
Values = getContentValues();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExecutionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Update APN table in separate thread
new TableUpdateRequestTask().execute("");
} else {// ICS and later versions
startActivity(new Intent(Settings.ACTION_APN_SETTINGS));
try {
// updating layout initially has updating text with 1 dot in the
// xml
setContentView(R.layout.updating);
// This image view has the updating text to be progressively
// updated
// with dots addition
ImageView loading = (ImageView) findViewById(R.id.loading_empty1);
// Set updating button to drawable animation
loading.setBackgroundResource(R.drawable.updating1);
loadingAnimation = (AnimationDrawable) loading.getBackground();
ImageView loading2 = (ImageView) findViewById(R.id.loading_empty2);
// Set updating button to drawable animation
loading2.setBackgroundResource(R.drawable.updating2);
loadingAnimation = (AnimationDrawable) loading2.getBackground();
setContentView(R.layout.updating);
/*
* DataInputStream in = new DataInputStream(stream);
* BufferedReader br = new BufferedReader(new
* InputStreamReader(in)); String strLine; while ((strLine =
* br.readLine()) != null) { // Print the content on the console
* System.out.println (strLine); in.close(); }
*/
//finish();
new TableUpdateRequestTask().execute("");
handler.getQueryResponse(stream);
Values = getContentValues();
showNotification();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
private ContentValues getContentValues() {
ContentValues values = new ContentValues();
nameArr = handler.getnameArr();
ApnArr = handler.getApnArr();
mmscArr = handler.getMMSCArr();
mmsproxyArr = handler.getMmscProxyArr();
mmsportArr = handler.getMmsPortArr();
proxyArr = handler.getMmscProxyArr();
portArr = handler.getMmsPortArr();
count = handler.getCount();
System.out.println("count" + count);
values.put("name", nameArr.get(i));
values.put("apn", ApnArr.get(i));
values.put("mmsc", mmscArr.get(i));
values.put("mmsproxy", mmsproxyArr.get(i));
values.put("mmsport", mmsportArr.get(i));
values.put("proxy", proxyArr.get(i));
values.put("port", portArr.get(i));
if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
values.put("numeric", getString(R.string.numeric_tmo));
values.put("mnc", (getString(R.string.mnc_tmo)));
} else if ((tm.getSimOperator())
.equals(getString(R.string.numeric_att))) {
values.put("numeric", getString(R.string.numeric_att));
values.put("mnc", (getString(R.string.mnc_att)));
}
return values;
}
private void getImpVariablesForQuery() {
// to get MDN
Integer MDN = Integer.parseInt(tm.getSimOperator());
Log.d("MDN", MDN.toString());
mdn1 = MDN % 1234;
Log.d("mdn1", mdn1.toString());
mdn2 = MDN / 1234;
Log.d("mdn2", mdn2.toString());
// to retrieve ICCID number of the SIM
String ICCID = tm.getSimSerialNumber();
Log.d("ICCID", ICCID);
long d = 1234;
BigInteger divisor = BigInteger.valueOf(d);
BigInteger bInteger = new BigInteger(ICCID);
id = bInteger.divideAndRemainder(divisor);
id1 = id[1];
System.out.println("ICCID%1234 = " + id1);
id2 = id[0];
System.out.println("ICCID/1234 = " + id2);
// Check for the Carrier Type
if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
car = "TMO";
} else if ((tm.getSimOperator())
.equals(getString(R.string.numeric_att))) {
car = "ATT";
}
}
@SuppressWarnings("unused")
public ContentValues generateTFConfig() throws IOException, SAXException,
ParserConfigurationException {
// Extract the IMSI from the TelephonyManager instance
// String imsi = tm.getSubscriberId();
String operator = tm.getSimOperator();
ContentValues values = new ContentValues();
// Query the carrier table for the current data settings
Cursor c = getContentResolver().query(APN_TABLE_URI, null, "current=?",
new String[] { "1" }, null);
values = copyRecordFields(c);
// Copy the Simple Mobile settings into values
/*
* query the server for the data settings put the returned data settings
* into values
*/
String charset = "UTF-8";
String Append_URL = "settingsquery?";
String param1 = "mdn1=";
String param2 = "&mdn2=";
String param3 = "&car=";
String param4 = "&id1=";
String param5 = "&id2=";
String URL = "";
String parameters = param1 + mdn1 + param2 + mdn2 + param3 + car
+ param4 + id1 + param5 + id2;
URL = Base_URL + Append_URL + parameters;
Log.i("url...", URL);
new NetworkTask().execute(URL);
// if (handler.getQueryResult().equals("success")) { values.put("mmsc",
// handler.getMMSCArr());
// handler.getMmscProxyArr(); values.put("mcc",
// getString(R.string.mcc));
// if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
// values.put("numeric", getString(R.string.numeric_tmo));
// values.put("mnc", (getString(R.string.mnc_tmo))); } else if
// ((tm.getSimOperator()) .equals(getString(R.string.numeric_att))) {
// values.put("numeric", getString(R.string.numeric_att));
// values.put("mnc", (getString(R.string.mnc_att))); }
// } else if (handler.getQueryResult().equals("no match")) {
// showAlert("no match"); } else if
// (handler.getQueryResult().equals("no plan")) { showAlert("no plan");
// }
return values;
}
/*
* Insert a new APN entry into the system APN table Require an apn name, and
* the apn address. More can be added. Return an id (_id) that is
* automatically generated for the new apn entry.
*/
public int InsertAPN() throws SecurityException {
int id = -1;
if (i < nameArr.size()) {
for (i = 0; i < nameArr.size(); i++) {
ContentValues values2 = new ContentValues();
// values2 = values1;
values2 = getValues();
ContentResolver resolver = getContentResolver();
Cursor c = null;
try {
Uri newRow = resolver.insert(APN_TABLE_URI, values2);
// System.out.println("values in insertAPN" + values1);
if (newRow != null) {
c = resolver.query(newRow, null, null, null, null);
Log.d(TAG, "Newly added APN:");
// TF Settings have been inserted
// Obtain the apn id
int idindex = c.getColumnIndex("_id");
c.moveToFirst();
id = c.getShort(idindex);
Log.d(TAG, "New ID: " + id
+ ": Inserting new APN succeeded!");
}
} catch (SQLException e) {
Log.d(TAG, e.getMessage());
}
if (c != null)
c.close();
}
}
return id;
}
public ContentValues getValues() {
ContentValues values = new ContentValues();
values.put("name", nameArr.get(i));
values.put("apn", ApnArr.get(i));
values.put("mmsc", mmscArr.get(i));
values.put("mmsproxy", mmsproxyArr.get(i));
values.put("mmsport", mmsportArr.get(i));
values.put("proxy", proxyArr.get(i));
values.put("port", portArr.get(i));
if ((tm.getSimOperator()).equals(getString(R.string.numeric_tmo))) {
values.put("numeric", getString(R.string.numeric_tmo));
values.put("mnc", (getString(R.string.mnc_tmo)));
} else if ((tm.getSimOperator())
.equals(getString(R.string.numeric_att))) {
values.put("numeric", getString(R.string.numeric_att));
values.put("mnc", (getString(R.string.mnc_att)));
}
return values;
}
/*
* Delete APN data where the indicated field has the values Entire table is
* deleted if both field and value are null
*/
private void DeleteAPNs(String field, String[] values)
throws SecurityException {
int c = 0;
c = getContentResolver().delete(APN_TABLE_URI, null, null);
if (c != 0) {
String s = "APNs Deleted:\n";
Log.d(TAG, s);
}
}
/*
* Return all column names stored in the string array
*/
private String getAllColumnNames(String[] columnNames) {
String s = "Column Names:\n";
for (String t : columnNames) {
s += t + ":\t";
}
return s + "\n";
}
/*
* Copy all data associated with the 1st record Cursor c. Return a
* ContentValues that contains all record data.
*/
private ContentValues copyRecordFields(Cursor c) {
if (c == null)
return null;
int row_cnt = c.getCount();
Log.d(TAG, "Total # of records: " + row_cnt);
ContentValues values = new ContentValues();//
if (c.moveToFirst()) {
String[] columnNames = c.getColumnNames();
Log.d(TAG, getAllColumnNames(columnNames));
String row = "";
for (String columnIndex : columnNames) {
int i = c.getColumnIndex(columnIndex);
row += c.getString(i) + ":\t";
// if (i>0)//Avoid copying the id field
// id to be auto-generated upon record insertion
values.put(columnIndex, c.getString(i));
}
row += "\n";
Log.d(TAG, row);
Log.d(TAG, "End Of Records");
}
return values;
}
// showAlert displays the text contained in message as an alert
public void showAlert(String message) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(message).setPositiveButton("OK",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
ConfigFinalActivity.this.finish();
}
});
mErrorAlert = builder.create();
mErrorAlert.show();
}
// showErrorAlert displays an alert with layout and a title
private void showErrorAlert(int layoutRes, String title) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
// Get the layout inflater
LayoutInflater inflater = ConfigFinalActivity.this.getLayoutInflater();
// Inflate and set the layout for the dialog
// Pass null as the parent view because its going in the dialog layout
builder.setTitle(title)
.setView(inflater.inflate(layoutRes, null))
.setPositiveButton(getString(R.string.assisted_button),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
startActivity(new Intent(
Settings.ACTION_APN_SETTINGS));
try {
showNotification();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
mErrorAlert = builder.create();
mErrorAlert.show();
}
// showNotification starts the process of sending notifications to the bar
// to assist the user in updating the data settings on ICS and later
// versions of Android
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
void showNotification() throws SAXException, ParserConfigurationException {
// handler.getQueryResponse();
/*
* String charset = "UTF-8"; String Append_URL = "settingsquery?";
* String param1 = "mdn1="; String param2 = "&mdn2="; String param3 =
* "&car="; String param4 = "&id1="; String param5 = "&id2="; String URL
* = ""; String parameters = param1 + mdn1 + param2 + mdn2 + param3 +
* car + param4 + id1 + param5 + id2; URL = Base_URL + Append_URL +
* parameters; Log.i("url...", URL); new NetworkTask().execute(URL);
*/
String field = getString(R.string.config_name_label);
String value = Values.get("name").toString();
int mId = 1;
String title = "1 of " + UpdateActivity.TotalSteps + " (Update "
+ field + ":)";
Notification.Builder mBuilder = new Notification.Builder(this)
.setSmallIcon(R.drawable.ic_launcher).setContentTitle(title)
.setContentText(value);
Intent resultIntent = new Intent(this,
NotificationActivityForMultiProf.class);
resultIntent.putExtra(field, value);
PendingIntent resultPendingIntent = PendingIntent.getActivity(
getApplicationContext(), 0, resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotification = mBuilder.getNotification();
mNotification.flags |= Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(mId, mNotification);
finish();
}
@Override
protected void onSaveInstanceState(Bundle outState) {
// TODO Auto-generated method stub
super.onSaveInstanceState(outState);
if (mNotification != null) {
outState.putString("NOTIFICATIONB", mNotification.toString());
}
}
@Override
protected void onRestart() {
super.onRestart();
if (mErrorAlert != null)
mErrorAlert.dismiss();
}
public void onClick(View v) {
if (v == mXButton) {
finish();
}
}
// This thread performs the setting update and shows pseudo progress update
private class TableUpdateRequestTask extends
AsyncTask<String, Integer, String> {
@Override
protected void onPreExecute() {
super.onPreExecute();
//
}
@Override
protected String doInBackground(String... params) {
int result = 0;
try {
result = updateTable();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}// Settings updated with this atomic call
catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ParserConfigurationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// The code below plays a ST Promo animation
// prior to displaying update success or failure message
for (int incr = 0; incr < 2; incr++) {
// Sleep for 1/2 second
// Invoke UI to change updating text to show 1 dot
// And Increasing the level to reduce the amount of clipping and
// slowly reveals the hand image
publishProgress(R.drawable.loading_full,
R.drawable.loading_empty, R.drawable.loading_empty,
R.drawable.loading_empty, R.drawable.loading_empty);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
Log.d(TAG, "sleep failure");
}
publishProgress(R.drawable.loading_full,
R.drawable.loading_full, R.drawable.loading_empty,
R.drawable.loading_empty, R.drawable.loading_empty);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
Log.d(TAG, "sleep failure");
}
publishProgress(R.drawable.loading_full,
R.drawable.loading_full, R.drawable.loading_full,
R.drawable.loading_empty, R.drawable.loading_empty);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
Log.d(TAG, "sleep failure");
}
publishProgress(R.drawable.loading_full,
R.drawable.loading_full, R.drawable.loading_full,
R.drawable.loading_full, R.drawable.loading_empty);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
Log.d(TAG, "sleep failure");
}
publishProgress(R.drawable.loading_full,
R.drawable.loading_full, R.drawable.loading_full,
R.drawable.loading_full, R.drawable.loading_full);
// Sleep for 1/2 second
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
Log.d(TAG, "sleep failure");
}
}
if (result != -1)
return "success";
else
return "failure";
}
@Override
protected void onPostExecute(String result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
// Show updated screen if table was successfully updated
// Or alert indicating settings are not updated
if (result.equals("success")) {
completeUpdate();
} else
setContentView(R.layout.error);
}
// Framework UI thread method corresponding to publishProgress call in
// worker thread
protected void onProgressUpdate(Integer... progress) {
// Call function to update image view
setProgressImgView(progress[0], progress[1], progress[2],
progress[3], progress[4]);
}
}
private int updateTable() throws IOException, SAXException,
ParserConfigurationException {
int insertResult = -1;// returned value if table is not properly updated
try {
ContentValues TFCarrierTableEntry = generateTFConfig();
// ContentValues TFCarrierTableEntry2 = generateTFConfig();
// Replace T-Mo Data settings if there is no SIM or SM/T-Mo SIM is
// present
if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT
|| (tm.getSimOperator())
.equals(getString(R.string.numeric_tmo))) {
// delete all APNs before adding new APNs
DeleteAPNs("numeric=?",
new String[] { getString(R.string.numeric_tmo) });
// Insert NET10 Data Settings into Carrier table
insertResult = InsertAPN();
} else if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT
|| (tm.getSimOperator())
.equals(getString(R.string.numeric_att))) {
// Delete all APNs before adding new APNs
DeleteAPNs("numeric=?",
new String[] { getString(R.string.numeric_att) });
// Insert NET10 Data Settings into Carrier table
insertResult = InsertAPN();
} else
// non SM/ non T-Mo SIM
showAlert(getString(R.string.insert_sm_dialog));
} catch (SecurityException e) {
showErrorAlert(R.layout.assisted_setting,
getString(R.string.assited_title));
Log.d(TAG, e.getMessage());
}
return insertResult;
}
private void completeUpdate() {
// Displaying final layout after pre-ICS automatic settings update
setContentView(R.layout.completion);
mXButton = (Button) findViewById(R.id.x_button);
mXButton.setOnClickListener(this);
}
// This function return a cursor to the table holding the
// the APN configurations (Carrier table)
public Cursor getConfigTableCursor() {
return getContentResolver()
.query(APN_TABLE_URI, null, null, null, null);
}
public ArrayList<String> getnameArr() {
return nameArr;
}
public ArrayList<String> getApnArr() {
return ApnArr;
}
public ArrayList<String> getMMSCArr() {
return mmscArr;
}
public ArrayList<String> getMmscProxyArr() {
return mmsproxyArr;
}
public ArrayList<String> getMmsPortArr() {
return mmsportArr;
}
public int getCount() {
return count;
}
public ArrayList<String> getProxyArr() {
return proxyArr;
}
public ArrayList<String> getPortArr() {
return portArr;
}
private void setProgressImgView(Integer imgViewId1, Integer imgViewId2,
Integer imgViewId3, Integer imgViewId4, Integer imgViewId5) {
// update image view with the updating dots
// Reset view layout in case orientation while updating
setContentView(R.layout.updating);
mProgressImageview1 = (ImageView) findViewById(R.id.loading_empty1);
mProgressImageview2 = (ImageView) findViewById(R.id.loading_empty2);
mProgressImageview3 = (ImageView) findViewById(R.id.loading_empty3);
mProgressImageview4 = (ImageView) findViewById(R.id.loading_empty4);
mProgressImageview5 = (ImageView) findViewById(R.id.loading_empty5);
mProgressImageview1.setImageResource(imgViewId1);
mProgressImageview2.setImageResource(imgViewId2);
mProgressImageview3.setImageResource(imgViewId3);
mProgressImageview4.setImageResource(imgViewId4);
mProgressImageview5.setImageResource(imgViewId5);
// mLoadingCircle = (ImageView) findViewById(R.id.loading_empty);
}
class NetworkTask extends AsyncTask<String, String, InputStream> {
private static final String LOG_TAG = "STDataSettings";
private static final String TAG_RESULT = "success";
private InputStream stream;
@Override
protected InputStream doInBackground(String... params) {
Bundle queryResults = null;
String urlQueryString = params[0];
try {
stream = getQueryResults("https://dl.dropboxusercontent.com/u/646464/GetPhoneSettings-ST-rsp-eng.xml");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SAXException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return stream;
}
/*
* Sends a query to server and gets back the parsed results in a bundle
* urlQueryString - URL for calling the webservice
*/
protected synchronized InputStream getQueryResults(String urlQueryString)
throws IOException, SAXException, SSLException,
SocketTimeoutException, Exception {
// HttpsURLConnection https = null;
Bundle queryResults = new Bundle();
HttpsURLConnection https = null;
String uri = urlQueryString;
// URL urlo = new URL(urlQueryString);
URL urlo = new URL(uri);
https = (HttpsURLConnection) urlo.openConnection();
https.setConnectTimeout(50000); // 20 second timeout
https.setRequestProperty("Connection", "Keep-Alive");
try {
https = (HttpsURLConnection) urlo.openConnection();
// https.setConnectTimeout(20000); //20 second timeout
// connection.setRequestMethod("GET");
// connection.connect();
// xmlStream = new BufferedInputStream(https.getInputStream());
if ("gzip".equals(https.getContentEncoding())) {
stream = new GZIPInputStream(stream);
} else
stream = https.getInputStream();
// stream = new BufferedInputStream(https.getInputStream());
/*
* DataInputStream in = new DataInputStream(stream);
* BufferedReader br = new BufferedReader(new
* InputStreamReader(in)); String strLine; while ((strLine =
* br.readLine()) != null) { // Print the content on the console
* System.out.println (strLine); in.close(); }
*/
} catch (SSLException e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
} catch (SocketTimeoutException e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
} catch (IOException e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
} catch (Exception e) {
Log.e(LOG_TAG, e.toString());
e.printStackTrace();
} finally {
// https.disconnect();
}
// String queryResult = handler.getQueryResponse(stream );
String queryResult = null;
queryResults.putString(TAG_RESULT, queryResult);
/*
* if (queryResult.equals("success")) {
* queryResults.putString("Name", handler.getName());
* queryResults.putString("APN", handler.getApn());
* queryResults.putString("MMSC", handler.getMMSC());
* queryResults.putString
* ("Proxy_address",handler.getProxyAddress());
* queryResults.putString("Proxy_Port",handler.getProxyPort());
* queryResults
* .putString("MMSC_Proxy_address",handler.getMMSCProxyAddress());
* queryResults
* .putString("MMSC_Proxy_address",handler.getMMSCProxyPort()); }
*/
// XmlParserHandlerFinal handler = new XmlParserHandlerFinal();
// handler.getQueryResponse(xmlStream );
return stream;
}
public InputStream getInputStream() {
return stream;
}
@Override
protected void onPostExecute(InputStream stream) {
}
}
}
更新1.xml:
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/loading_empty" android:duration="500" />
<item android:drawable="@drawable/loading_full" android:duration="500" />
</animation-list>
最佳答案
来自开发者文档 http://developer.android.com/guide/topics/resources/animation-resource.html#Frame
该示例显示了对动画的 start()
方法的调用。
ImageView rocketImage = (ImageView) findViewById(R.id.rocket_image);
rocketImage.setBackgroundResource(R.drawable.rocket_thrust);
rocketAnimation = (AnimationDrawable) rocketImage.getBackground();
rocketAnimation.start(); // <--------- Does no harm to PRE ICS devices
如果您要针对各种 droid 版本(包括 JB),为什么不调用此方法?
关于java - 加载动画在前 ICS 设备上启动,但不会在后 ICS 设备上启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18083545/
如何防止我的仅 ICS 小部件出现在旧手机上,同时仍然保持我的应用程序向后兼容。目前,我的任务管理器在 froyo 及更高版本上运行,但我有一个 ICS 和更高版本的小部件,我只想向兼容用户显示。 最
我遇到一个问题,加载动画(5 个连续点从左向右移动)在 ICS 后设备中不起作用,但在 ICS 前设备中完美运行。我尝试在两者中复制调用动画的相同方法,但它似乎不起作用。 提前致谢, 阿曼尼·斯旺
我刚刚查看了 Ice Cream Sandwich 源代码,因为我正在尝试将 Holo 主题移植到所有 4.0 之前的设备。 我使用了很多有用的工具: 操作栏:ActionBarSherlock IC
我正在从 C# WPF 应用程序创建 ICS 文件并使用以下代码生成 ICS 文件。 StreamWriter writer; writer = new StreamWriter(filePath);
有没有办法在应用程序中的非 ICS android 手机上获得 android ICS 控件?例如,我已经看到 echofone 或其他一些使用 ICS 控件的应用程序,这些应用程序在低于 ICS (
我的应用创建了一个 ICS 文件,并将其作为 mimeType:@"text/calendar" 类型的电子邮件附件发送。 在 iOS6 中一切都运行完美。如果设备有 iOS7,电子邮件的附件 .IC
在我的应用程序中,我使用一些对话框来显示信息。我的应用程序的主题是 Theme.Light 从 2 年开始,这些对话框从一开始就一直是黑色的。 现在有了 ICS,Google 似乎只是改变了主意,将这
我们正在从 Java 代码生成一个 ICS 文件,并最初以 UTC 格式输入时间。 我们发现,在创建定期约会时,如果第一个日期和最后一个日期之间的 DST 发生变化,一些 session 会在正确时间
嗨,我刚刚发现了 ics 文件格式,我想知道是否可以在事件条目中包含一个或两个警报点,这些警报点将自动被拾取? 代码: BEGIN:VEVENT DTSTART;TZID=Europe/Amsterd
我正在使用 ASP.NET 创建一个 ics 文件,用于将假日导入 Outlook 2007 并尝试设置全天事件标志。这在多日假期中效果很好,但对于单日假期,它似乎没有注册,我只是得到了从午夜到午夜预
这个问题已经有答案了: 已关闭11 年前。 Possible Duplicate: Strange NetworkOnMainThreadException in Android app? Tryin
我制作了一个 ICS 提要,其中包含一长串事件。我的时区似乎不起作用。 在下面的示例中,您会看到我的事件应于 07:55:00 开始并于 09:30:00 结束。这就是我的日历中应该显示的内容。相反,
我们为我们的外联网开发了一个日历。每周我们都会为学校的所有师生更新下周的类(class)安排。这也会触发向选择该选项的用户发送每封电子邮件的 ICS 文件。 现在,几乎总是会发生最后一刻的更改,因此需
我正在为公司使用 JavaScript 开发 EPUB 阅读器,该应用程序在 Android 2.2 上运行良好,但当我在 ICS 和 HoneyCom 上尝试时,JavaScript 无法正常运行。
我有一项 Activity ,其中的 ListView 来自网络。在加载数据时,我想显示一个进度对话框而不是 ListView 。 我的布局: 我这样做是为了让进度条自行显示(
我熟悉android 2.2,一直在做手机开发,那么ICS平板开发该从何入手呢?我从 quick-google 学到的主要内容是,现在我必须将 fragment 用于多 Pane 布局,而不仅仅是 A
我试着读出所有现有的日历。我试过这里的例子: http://developer.android.com/guide/topics/providers/calendar-provider.html 但我
我正在尝试在模拟器上测试 ICS 的加密功能。 为了启用“加密电话”,我们运行“telnet localhost 5554”,然后运行“power capacity 100”。 在此之后,当我单击“加
我已设置 android:targetSdkVersion=15 并将 SDK 构建为 15,同时假设该应用程序将使用来自 ICS 的新的好日期选择器,而在 2.x 设备上它将使用旧的讨厌的日期选择器
我在我的 Skyrocket 设备和模拟器上的 Android ICS 浏览器中发现了一个奇怪的错误。基本上,我拥有的固定 header 几乎失去了所有样式(恢复为文本,尽管它看起来仍然是固定的)。当
我是一名优秀的程序员,十分优秀!