Doğru Cevap
-
aklıma ilk gelen ekrana yatay şelikde yerleştirme yapacak bir linerlayout koy.
sonra bunun içine 3 tane imageview ekle android:weight =1 yap 3'ü için sana istediğini sağlayacak diye düşünüyorum. Sonra o imageviewlerin içine istediğin resmi koy.-
iremcnbrts
Dediginiz gibi yaptim. MainActivity de su sekilde denedigimde sadece 3.resmi aciyor ekrana.
setContentView(R.layout.activity_main); LinearLayout ll = (LinearLayout) findViewById(R.id.lMain); ImageView imageCode1 = new ImageView(this); ImageView imageCode2 = new ImageView(this); ImageView imageCode3 = new ImageView(this); imageCode1.setImageResource(R.drawable.image1); imageCode2.setImageResource(R.drawable.image2); imageCode3.setImageResource(R.drawable.image3); setContentView(imageCode1); setContentView(imageCode2); setContentView(imageCode3);
bu da activity_main.xml dosyasi
<?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:id="@+id/lMain"> <ImageView android:id = "@+id/image1" android:layout_width="100dp" android:layout_height="100dp" android:layout_x="100dp" android:layout_y="100dp" /> <ImageView android:id = "@+id/image2" android:layout_width="100dp" android:layout_height="100dp" android:layout_x="250dp" android:layout_y="100dp" /> <ImageView android:id = "@+id/image3" android:layout_width="100dp" android:layout_height="100dp" android:layout_x="400dp" android:layout_y="100dp" /> </LinearLayout>
9 yıl önce yazılmış 9 yıl önce güncellenmiş -
SarraS
main act yi aşağıdaki şekilde değiştir.ImageView imageCode1 = (ImageView)findViewById(R.id.image1); ImageView imageCode2 = (ImageView)findViewById(R.id.image2); ImageView imageCode3 = (ImageView)findViewById(R.id.image3);
sonrada xml içindeki ImageViewlere android:weight ="1" özelliğini koy.
Buradaki 1 her image için eşit uzunluk verecek. ortadakini 2 yaparsan. ekranın %50si 2resim diğerleri %25 olarak paylaşacaklar.9 yıl önce yazılmış -
iremcnbrts
xml dosyasini o sekilde degistirdigimde bu hatayi veriyor
Multiple annotations found at this line:
- [Accessibility] Missing contentDescription attribute on image
- error: No resource identifier found for attribute 'weight' in package
'android'9 yıl önce yazılmış -
SarraS
android:layout_weight="1" şeklinde dene olacaktır.
elimde android emulator olmadığı için deneyemiyorum.9 yıl önce yazılmış -
iremcnbrts
Bu sefer de uygulama acilip kapaniyor :( Su hatayi verdi
specified child already has a parent. You must call removeView() on the child's parent first9 yıl önce yazılmış -
SarraS
istersen projeyi gönder akşam 10dan sonra inceleyip sana kesin çözüm söyleyeyim.9 yıl önce yazılmış -
SarraS
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="100dp" android:layout_weight="1" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="100dp" android:layout_weight="1" android:src="@drawable/ic_launcher" /> <ImageView android:id="@+id/imageView3" android:layout_width="wrap_content" android:layout_height="100dp" android:layout_weight="1" android:src="@drawable/ic_launcher" /> </LinearLayout>
http://hizliresim.com/4Y14P79 yıl önce yazılmış 9 yıl önce güncellenmiş
-
Cevaplar
Hiç cevap bulunamadı.