Soru & Cevap

textView Background sorunu

18.07.2014 - 01:01

merhabalar 

string array den aldıgım verileri listeliyorum ama bu xml e arka fon koymak ıstedgımde listenin her itemine ayrı yarı fon yerleştiriyor. textView layout suz kullanıyorum fon ekleyınce bu hatayı veriyor. textView bir layout içine koydugumda da "sonlandırıldı" hatası alıyorum. Yardım ?

liste.xml

[code]

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/TextView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:background="@drawable/image"
    android:padding="4sp"
    android:textColor="#140718"
    android:textSize="22sp" />

 

[/code]

28 Görüntülenme

2 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Geleceği Yazanlar Kullanıcısı
19.07.2014 - 07:29

LogCat 

[code]

07-19 19:28:19.316: W/ApplicationPackageManager(5326): getCSCPackageItemText()
07-19 19:28:19.431: D/dalvikvm(5326): GC_FOR_ALLOC freed 77K, 8% free 16840K/18304K, paused 64ms, total 64ms
07-19 19:28:19.446: I/dalvikvm-heap(5326): Grow heap (frag case) to 22.541MB for 4976656-byte allocation
07-19 19:28:19.461: D/dalvikvm(5326): GC_FOR_ALLOC freed <1K, 7% free 21700K/23168K, paused 15ms, total 15ms
07-19 19:28:19.711: D/OpenGLRenderer(5326): Enabling debug mode 0
07-19 19:28:21.551: W/ApplicationPackageManager(5326): getCSCPackageItemText()
07-19 19:28:21.606: D/AbsListView(5326): Get MotionRecognitionManager
07-19 19:28:21.631: D/AbsListView(5326): onVisibilityChanged() is called, visibility : 4
07-19 19:28:21.631: D/AbsListView(5326): unregisterIRListener() is called 
07-19 19:28:21.631: D/AbsListView(5326): onVisibilityChanged() is called, visibility : 0
07-19 19:28:21.631: D/AbsListView(5326): unregisterIRListener() is called 
07-19 19:28:21.636: D/AbsListView(5326): unregisterIRListener() is called 
07-19 19:28:21.691: E/ArrayAdapter(5326): You must supply a resource ID for a TextView
07-19 19:28:21.691: D/AndroidRuntime(5326): Shutting down VM
07-19 19:28:21.691: W/dalvikvm(5326): threadid=1: thread exiting with uncaught exception (group=0x417d7c08)
07-19 19:28:21.706: E/AndroidRuntime(5326): FATAL EXCEPTION: main
07-19 19:28:21.706: E/AndroidRuntime(5326): Process: com.MFOco.dorthkissalar, PID: 5326
07-19 19:28:21.706: E/AndroidRuntime(5326): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:386)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ArrayAdapter.getView(ArrayAdapter.java:362)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.AbsListView.obtainView(AbsListView.java:2720)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ListView.makeAndAddView(ListView.java:1801)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ListView.fillDown(ListView.java:697)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ListView.fillFromTop(ListView.java:763)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ListView.layoutChildren(ListView.java:1641)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.AbsListView.onLayout(AbsListView.java:2533)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.View.layout(View.java:15655)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewGroup.layout(ViewGroup.java:4856)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.View.layout(View.java:15655)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewGroup.layout(ViewGroup.java:4856)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1677)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1531)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.LinearLayout.onLayout(LinearLayout.java:1440)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.View.layout(View.java:15655)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewGroup.layout(ViewGroup.java:4856)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.FrameLayout.layoutChildren(FrameLayout.java:453)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.FrameLayout.onLayout(FrameLayout.java:388)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.View.layout(View.java:15655)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewGroup.layout(ViewGroup.java:4856)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2285)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2005)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1235)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6472)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.Choreographer$CallbackRecord.run(Choreographer.java:803)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.Choreographer.doCallbacks(Choreographer.java:603)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.Choreographer.doFrame(Choreographer.java:573)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:789)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.os.Handler.handleCallback(Handler.java:733)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.os.Handler.dispatchMessage(Handler.java:95)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.os.Looper.loop(Looper.java:157)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.app.ActivityThread.main(ActivityThread.java:5356)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at java.lang.reflect.Method.invokeNative(Native Method)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at java.lang.reflect.Method.invoke(Method.java:515)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
07-19 19:28:21.706: E/AndroidRuntime(5326):     at dalvik.system.NativeStart.main(Native Method)
07-19 19:28:21.706: E/AndroidRuntime(5326): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView
07-19 19:28:21.706: E/AndroidRuntime(5326):     at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:379)
07-19 19:28:21.706: E/AndroidRuntime(5326):     ... 39 more
07-19 19:28:23.056: I/Process(5326): Sending signal. PID: 5326 SIG: 9

 

[/code]

picture-830-1447858140.jpg
onur
18.07.2014 - 10:32

Arkaplanı listview'e vermeyi de deneyebilirsin

Geleceği Yazanlar Kullanıcısı
19.07.2014 - 07:31
boyle yapınca her row ayrı ayrı arka plan yerleşiyor. arkaplanın sadece rengını degiştirdiğimde sıkıntı cıkmıyor. ama resim eklemek istiyorum
picture-1372-1408467635.jpg
ahmtbrk
18.07.2014 - 03:24
Merhaba kolay gelsin anladigim kadariyla listview e veri basiyorsun textview i herhangi bi layout olustur ona kopyala ve textview e ait xmlns yi sil. Hata verirsede buraya hatayi resim ya da txt olarak ekle sana zahmet.
Geleceği Yazanlar Kullanıcısı
19.07.2014 - 07:29
textview i herhangi bir layout un altına atınca durduruldu hatası veriyor logcat aşağıda;