在Textview中显示指示

时间:2012-07-31 05:47:26

标签: android textview

在我的应用程序中,我有1个列表视图,其中4个文本视图作为列方式。我显示数据库中的数据,因为一些数据具有一些递归值而其他数据不会。所以我必须有该数据的指示图像我有一个想法在列表视图中的第二个文本视图的末尾放置一些小图像。如果我尝试在xml中放置一些文本视图并设置一些图像,这意味着另一个文本视图(textview 3,4也是错位的。有没有人做任何事情。我也尝试过spannableimage但没有得到理想的结果。谢谢你提前。

我有什么: 我的列表视图:

31/7/2012 | gfdhh  |  78  |   78

我想要的是:

31/7/2012  | gfdhh* | 78  |78.

我的代码:(对于listview)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:id="@+id/Layout1"
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:paddingTop="4dip"
     android:paddingBottom="6dip"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:orientation="horizontal"
     >     

     <TextView android:id="@+id/text1"      
        android:layout_width="80dip"
        android:layout_height="wrap_content"        
        /> 

     <View
            android:layout_width="1dp"
            android:layout_height="fill_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginRight="2dp"
            android:background="#FF909090" />

     <TextView android:id="@+id/text3"          
        android:layout_width="60dip"
        android:layout_height="wrap_content"        
        android:layout_marginLeft="30dp"/>




     <View
            android:layout_width="1dp"
            android:layout_height="fill_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginRight="2dp"
            android:background="#FF909090" />

       <TextView android:id="@+id/text5"            
        android:layout_width="60dip"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dp"
        />
       <View
            android:layout_width="1dp"
            android:layout_height="fill_parent"
            android:layout_marginLeft="2dp"
            android:layout_marginRight="2dp"
            android:background="#FF909090" />

        <TextView android:id="@+id/text7"           
        android:layout_width="60dip"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        />

          <TextView android:id="@+id/text9"         
        android:layout_width="60dip"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"            
         android:visibility="gone"/>


</LinearLayout>

我尝试过的可跨越图像代码:

SpannableString ss = new SpannableString(cursor.getString(cursor.getColumnIndex(db.KEY_DESC))); 
                                Drawable d = getResources().getDrawable(R.drawable.up); 
                                d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); 
                                ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE); 
                                ss.setSpan(span, 0,cursor.getString(cursor.getColumnIndex(db.KEY_DESC)).length() , Spannable.SPAN_INCLUSIVE_EXCLUSIVE); 
                                text3.setText(ss); 

0 个答案:

没有答案