簡體   English   中英

無法使文本在Android TableLayout中垂直和水平居中

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

我在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>

ImageView中的圖像高26像素。 我希望TextView中的文本水平和垂直居中。 它居中,但位於框的頂部。 我確定我忽略了一些愚蠢的事情……謝謝!

您在center_vertical中缺少“ c”嗎?

您如何擴大觀點? inflate(id,parent,false)嗎? 否則嘗試

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM