开发者

Can't get text to center vertical and horizontal in Android TableLayout

I have the following in a TableRow:

        <TextView 
            android:text="Current" 
            android:id="@+id/theScreen" 
            android:layout_width="wrap_content" 
            android:padding="2px" 
            android:typeface="monospace" 
            android:textStyle="bold" 
            android:gravity="enter_vertical|center_horizontal">
        </TextView>

        <ImageView 
            android:id="@+id/rightArrow" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content"
            android:focusable="false"
            android:padding="2px"
            android:src="@drawable/right_arrow">
        </ImageView>

The image in the ImageView is 26 pixels high. I want the text in the TextView to be centered both horizont开发者_JAVA技巧ally and vertically. It is centered but stays at the top of the box. I'm sure I'm overlooking something stupid... Thanks!


How do you inflate your view ? inflate(id, parent, false) ? otherwise try


You are missing a "c" in center_vertical?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜