2012-09-16 13 views
5

मैं नीचे दिखाए गए पंक्तियों के दाईं ओर बटन के साथ एक टेबल बनाना चाहता हूं। मैं प्रत्येक पंक्ति के दाईं ओर पैडिंग सेट करना चाहता हूं लेकिन यह सही बटन में "खाता है"। बटन के प्रदर्शन समझौता किए बिना पैडिंग करने का कोई तरीका है?एंड्रॉइड टेबललेआउट पंक्ति पैडिंग

Screen shot of the table layout

यहाँ मेरी लेआउट एक्सएमएल कोड है:

<RelativeLayout 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" 
android:padding="10dp" > 

<TableLayout 
    android:id="@+id/tbl_test" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="#000000" 
    android:orientation="vertical" 
    android:layout_marginTop="1dp" 
    android:layout_marginBottom="1dp" 
    android:stretchColumns="1" 
    > 

    <TableRow android:background="#ffffff" android:layout_margin="1dp"> 

     <TextView android:text="Col 1" android:layout_column="0" /> 
     <TextView android:text="Col 2" android:layout_column="1" /> 
     <TextView android:text="Col 3" android:layout_column="2" /> 
     <TextView android:text="Col 4" android:layout_column="3" /> 

    </TableRow> 

    <TableRow 
     android:background="#ffffff" 
     android:layout_marginLeft="1dp" 
     android:layout_marginRight="1dp" 
     android:layout_marginBottom="1dp"> 

     <TextView android:text="r1" android:layout_column="0" /> 
     <TextView android:text="padding right 0dp" android:layout_column="1" /> 
     <Button android:text="edit" /> 
     <Button android:text="delete" /> 

    </TableRow> 

    <TableRow 
     android:background="#ffffff" 
     android:layout_marginLeft="1dp" 
     android:layout_marginRight="1dp" 
     android:layout_marginBottom="1dp" 
     android:paddingRight="2dp"> 

     <TextView android:text="r2" android:layout_column="0" /> 
     <TextView android:text="padding right 1dp" android:layout_column="1" /> 
     <Button android:text="edit" /> 
     <Button android:text="delete" /> 

    </TableRow> 

    <TableRow 
     android:background="#ffffff" 
     android:layout_marginLeft="1dp" 
     android:layout_marginRight="1dp" 
     android:layout_marginBottom="1dp" 
     android:paddingRight="3dp"> 

     <TextView android:text="r3" android:layout_column="0" /> 
     <TextView android:text="padding right 2dp" android:layout_column="1" /> 
     <Button android:text="edit" /> 
     <Button android:text="delete" /> 

    </TableRow> 

    <TableRow 
     android:background="#ffffff" 
     android:layout_marginLeft="1dp" 
     android:layout_marginRight="1dp" 
     android:layout_marginBottom="1dp" 
     android:paddingRight="4dp"> 

     <TextView android:text="r4" android:layout_column="0" /> 
     <TextView android:text="padding right 3dp" android:layout_column="1" /> 
     <Button android:text="edit" /> 
     <Button android:text="delete" /> 

    </TableRow> 

</TableLayout> 

</RelativeLayout> 

उत्तर

0

मैं नहीं जानता कि क्यों कतरन के साथ समस्या यह होता है, लेकिन एक आसान तरीका इसे ठीक करने और प्राप्त एक ही उपस्थिति दूर करने के लिए है करने के लिए paddingRightTableRows से विशेषता और पंक्ति के अंतिम आइटम पर layout_marginRight (पैडिंग मान पर सेट करें) विशेषता जोड़ें, Button हटाएं।

2

कोशिश

android:stretchColumns="0,1,2"

इस

के बाद समस्या का समाधान होगा
संबंधित मुद्दे