Προς το περιεχόμενο

Προτεινόμενες αναρτήσεις

Δημοσ.

Καλησπέρα παιδια.Έχω το εξης θέμα στο android. Θέλω να δημιουργήσω ένα bitmap με το background ενός linearlayout. Κάνω το εξής :

LinearLayout mylayout = (LinearLayout) findViewById(R.id.lout2);

mylayout.setDrawingCacheEnabled(true);

mylayout.buildDrawingCache();

 Bitmap bm = mylayout2.getDrawingCache();

το xml του layout ειναι του στυλ:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:background="@drawable/eikona"
    android:id="@+id/lout2"
    android:fitsSystemWindows="true"  >

    <Button
        android:id="@+id/bsetImage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="-20dp"
        android:text="Set Wallpapper"
        android:textColor="#ffffff"
        android:onClick="setAsWallpaper" />
    

    <Button
        android:id="@+id/button1"
        android:layout_width="100sp"
        android:layout_height="100sp"
        android:background="@drawable/color1"
        android:onClick="allagh1"
        android:layout_marginTop="80dp"
        android:layout_marginBottom="80dp"
        
         />

    <Button
        android:id="@+id/button2"
        android:layout_width="100sp"
        android:layout_height="100sp"
        android:background="@drawable/color2"
        android:onClick="allagh2"
        android:layout_marginTop="80dp"
        android:layout_marginBottom="80dp"
         
        />
    

</LinearLayout>

 αλλά το bitmap δημιουργεί όλο το layout δλδ εμφανίζε και τα κουμπια , εγώ θέλω να πέρνει μόνο το background χρώμα του layout , τι πρέπει να αλλάξω? έχετε καμιά ιδέα?

Δημοσ.

ok , επανέρχομαι με άλλη ερώτηση , έχει κανείς ιδέα για το πως μπορώ να κάνω render ένα bitmap στο background (απο πίσω) δλδ ο χρήστης να μην καταλάβει ότι κάτι αλλάζει

Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε

Πρέπει να είστε μέλος για να αφήσετε σχόλιο

Δημιουργία λογαριασμού

Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!

Δημιουργία νέου λογαριασμού

Σύνδεση

Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.

Συνδεθείτε τώρα
  • Δημιουργία νέου...