我爲Android設備上查看簡單的XML文件:爲什麼我在TextView保證金?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:id="@+id/recipe_step_number_textView"
android:text="STEP #NUM"
/>
<EditText
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:id="@+id/recipe_step_title_editText"
android:hint="add step title"/>
</LinearLayout>
他,你怎麼看,有很簡單的TextView和EditText上,但是TextView的有餘量排名前幾個像素,看起來是這樣的:
爲什麼我有保證金最高?
UPD非常感謝!正如我發現有很多方法來解決這些小問題,幾乎所有他們適合
此邊距因重力而變,因爲您使用的是android:gravity =「center」,所以textview的所有文本都在textview的中心偏移,因此您在文本頂部看到邊距 –