alpha-movie
alpha-movie copied to clipboard
java code new AlphaMovieView
Thank you for AlphaMovie。
How can i java code to new a AlphaMovieView ?
try this.
XmlPullParser xpp = getResources().getXml(R.xml.alpha_movie_view_xml);
try {
xpp.next();
xpp.nextTag();
} catch (Exception e) {
e.printStackTrace();
}
AttributeSet attr = Xml.asAttributeSet(xpp);
Log.i("attr count ",attr.getAttributeCount()+"");
final AlphaMovieView alpha = new AlphaMovieView(this, attr);
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
params.gravity = Gravity.CENTER;
alpha.setLayoutParams(params);
alpha.setOpaque(false);
frameLayout.addView(alpha);
and xml file like this
and my xml file likes this
<?xml version="1.0" encoding="utf-8"?>
<com.alphamovie.lib.AlphaMovieView
xmlns:custom="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_gravity="center"
custom:alphaColor="#00ff00"
custom:accuracy="0.4" />