Transparent Background Android example
android:background="@android:color/transparent"
<LinearLayout
android:baselineAligned="false"
android:background="@android:color/transparent"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<LinearLayout>
////////////////////////////
LinearLayout mLinearLayout1 = (LinearLayout)findViewById(R.id.linearLayout1);
mLinearLayout1.setBackgroundColor(Color.TRANSPARENT);
396LW NO topic_id
AD
Další témata ....(Topics)
////www.apache.org/licenses/LICENSE-2.0
private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private ColorMatrix mCM = new ColorMatrix();
private Bitmap mBitmap;
private float mSaturation;
private float mAngle;
//..........
mBitmap = BitmapFactory.decodeResource(context.getResources(),
R.drawable.my_image);
//..........
private static void setContrastScaleOnly(ColorMatrix cm, float contrast) {
float scale = contrast + 1.f;
float translate = (-.5f * scale + .5f) * 255.f;
cm.set(new float[] {
scale, 0, 0, 0, 0,
0, scale, 0, 0, 0,
0, 0, scale, 0, 0,
0, 0, 0, 1, 0 });
}
private static void setContrast(ColorMatrix cm, float contrast) {
float scale = contrast + 1.f;
float translate = (-.5f * scale + .5f) * 255.f;
cm.set(new float[] {
scale, 0, 0, 0, translate,
0, scale, 0, 0, translate,
0, 0, scale, 0, translate,
0, 0, 0, 1, 0 });
}
private static void setContrastTranslateOnly(ColorMatrix cm, float contrast) {
float scale = contrast + 1.f;
float translate = (-.5f * scale + .5f) * 255.f;
cm.set(new float[] {
1, 0, 0, 0, translate,
0, 1, 0, 0, translate,
0, 0, 1, 0, translate,
0, 0, 0, 1, 0 });
}
@Override protected void onDraw(Canvas canvas) {
Paint paint = mPaint;
float x = 20;
float y = 20;
canvas.drawColor(Color.WHITE);
paint.setColorFilter(null);
canvas.drawBitmap(mBitmap, x, y, paint);
ColorMatrix cm = new ColorMatrix();
mAngle += 2;
if (mAngle > 180) {
mAngle = 0;
}
//convert our animated angle [-180...180] to a contrast value of [-1..1]
float contrast = mAngle / 180.f;
setContrast(cm, contrast);
paint.setColorFilter(new ColorMatrixColorFilter(cm));
canvas.drawBitmap(mBitmap, x + mBitmap.getWidth() + 10, y, paint);
setContrastScaleOnly(cm, contrast);
paint.setColorFilter(new ColorMatrixColorFilter(cm));
canvas.drawBitmap(mBitmap, x, y + mBitmap.getHeight() + 10, paint);
setContrastTranslateOnly(cm, contrast);
paint.setColorFilter(new ColorMatrixColorFilter(cm));
canvas.drawBitmap(mBitmap, x, y + 2*(mBitmap.getHeight() + 10),
paint);
invalidate();
}
}
Definition of ListView in layout main.xml file Android example
Code in Main.java ListView example source code Java Android
<ListView android:id="@+id/idListView"
android:background="#7700CC00"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
Code in Main.java ListView example source code Java Android
public class Main extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView mlistView = (ListView) findViewById(R.id.idListView);
mlistView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1,
new String[] {"Game", "Help", "Home site"}));
mlistView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text Game, Help, Home
Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
Toast.LENGTH_SHORT).show();
}
});
}
}
If project is in workspace and only not visible in project explorer using this:
Click on some project in project explorer
Menu:
File
Import project
Existing Projects into Workspace
Eclipse Error: The container JRE System Library JavaSE references non existing library QTJava.zip
Workaround:
Windows->Preferences->Java->Installed JRE
Press Add and select your JRE folder path for example:
c:\Program Files\Java\jre7\
and check your choice.
Workaround:
Windows->Preferences->Java->Installed JRE
Press Add and select your JRE folder path for example:
c:\Program Files\Java\jre7\
and check your choice.
Try this solutions:
1.) Save xml file
2.) Close tab with xml file
3.) Reopen xml file
1.) Open from menu Window->Android SDK Manager
2.) Select available updates (Tools, SDK etc.)
3.) Install updates
1.) Open from menu Help->Check for Updates
2.) Install available plugins what You need
3.) Restart Eclipse
1.) Save xml file
2.) Close tab with xml file
3.) Reopen xml file
1.) Open from menu Window->Android SDK Manager
2.) Select available updates (Tools, SDK etc.)
3.) Install updates
1.) Open from menu Help->Check for Updates
2.) Install available plugins what You need
3.) Restart Eclipse
Editace: 2012-03-08 22:14:48
Počet článků v kategorii: 396
Url:transparent-background-android-example