Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien

[Android] hulp bij RelativeLayout

Pagina: 1
Acties:

  • roel0
  • Registratie: Maart 2011
  • Laatst online: 18:36
Ik probeer 2 imageviews onder elkaar te krijgen, maar de imageview wordt groter dan de image zelf waardoor ze niet tegen elkaar aankomen:
Afbeeldingslocatie: http://i39.tinypic.com/6h2c79.png

Hier is mijn xml:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    <RelativeLayout
        android:layout_width="fill_parent"  
        android:layout_height="fill_parent"     
        >

        <ImageView
            android:id="@+id/dia1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/desc"
            android:src="@drawable/dia1" />

        <ImageView
            android:id="@+id/dia2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/dia1"
            android:contentDescription="@string/desc"
            android:src="@drawable/dia2" />

    </RelativeLayout>

Hoe kan ik de view even groot maken als de afbeelding?

  • truegrit
  • Registratie: Augustus 2004
  • Laatst online: 19-11 23:52
In plaats van fill_parent moet je wrap_content gebruiken op de RelativeLayout

[ Voor 15% gewijzigd door truegrit op 15-08-2013 19:34 ]

hallo


  • roel0
  • Registratie: Maart 2011
  • Laatst online: 18:36
truegrit schreef op donderdag 15 augustus 2013 @ 19:33:
In plaats van fill_parent moet je wrap_content gebruiken op de RelativeLayout
Dat veranderd niets , misschien zit er nog uit probleem buiten de relativelayout om:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background_portrait"
    android:orientation="vertical" >

    <!-- header -->

    <ImageView
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:contentDescription="@string/desc"
        android:src="@drawable/header" />

    <RelativeLayout
        android:layout_width="wrap_content"  
        android:layout_height="wrap_content"     
        >

        <ImageView
            android:id="@+id/dia1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/desc"
            android:src="@drawable/dia1" />

        <ImageView
            android:id="@+id/dia2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/dia1"
            android:contentDescription="@string/desc"
            android:src="@drawable/dia2" />

    </RelativeLayout>
</LinearLayout >

  • SumBeam
  • Registratie: Maart 2006
  • Laatst online: 21-11 15:03
http://developer.android...._android:adjustViewBounds

adjustViewBounds="true" aan de imageview toevoegen?

Dus zoiets:

code:
1
2
3
4
5
6
7
<ImageView
            android:id="@+id/dia1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:contentDescription="@string/desc"
            android:adjustViewBounds="true"
            android:src="@drawable/dia1" />