wie Sie programmgesteuert erstellen Sie eine Bildansicht mit id und src-Parameter?

Folgende Werke, die ich aber ausschließen wollen, dass das xml, so dass ich ändern kann, das Bild programmatisch:
Java:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.p6_touch);
    ImageView floatImage = (ImageView) findViewById(R.id.p6_imageView);
    floatImage.setOnTouchListener(this);    
}

XML:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/background_black" >
    <ImageView
        android:id="@+id/p6_imageView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:scaleType="matrix"
        android:src="@drawable/p6_trail_map" >
    </ImageView>
    <ImageView
          android:id="@+id/imageView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"
          android:onClick="showFlashlight"
          android:src="@drawable/legend_block24" />
</FrameLayout>

InformationsquelleAutor user1905474 | 2012-12-15

Schreibe einen Kommentar