WEB开发网
开发学院手机开发Android 开发 Android 获取XML,DRAWABLE资源 阅读

Android 获取XML,DRAWABLE资源

 2012-07-01 09:41:10 来源:WEB开发网   
核心提示: -获取XML,DRAWABLE资源package gongzibai.co.cc;import android.app.Activity;import android.content.res.Resources;import android.os.Bundle;import android.view.ViewGrou

 ---------获取XML,DRAWABLE资源
package gongzibai.co.cc;
import android.app.Activity;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.ViewGroup.LayoutParams;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class Drawable1Activity extends
Activity {
LinearLayout mLinearLayout;
/** Called when the activity is first created. */
@Override
public void onCreate(
Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mLinearLayout = new LinearLayout(
this);
ImageView mImageView = new ImageView(
this);
mImageView
.setImageResource(R.drawable.anmo);
// mImageView
// .setAdjustViewBounds(true);
mImageView
.setLayoutParams(new Gallery.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));

mLinearLayout
.addView(mImageView);

setContentView(mLinearLayout);
}
}
-----------------XML获取资源 TransitionDrawable应用 两张图片实现淡入淡-----------------出切换...
---------drawable/photo
<?xml version="1.0" encoding="UTF-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android">

<item android:drawable="@drawable/background" />
<item android:drawable="@drawable/anmo" />

</transition>

------.java
package gongzibai.co.cc;
import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android

1 2  下一页

Tags:Android 获取 XML

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接