Android的:如何改变一个EditText领域的TEXTSIZE? [英] Android: How to change the textsize in an EditText field?

查看:97
本文介绍了Android的:如何改变一个EditText领域的TEXTSIZE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示与某些字段是可编辑的表格 - 看到这样的例子:

I want to display a table with some fields being editable - see this example:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:orientation="vertical"
 android:paddingLeft="1dip"
 android:paddingRight="1dip"
 android:paddingBottom="1dip"
 android:background="#F00"
 >
 <ScrollView
  android:id="@+id/ScrollView01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:scrollbars="vertical"
  >
  <HorizontalScrollView
   android:id="@+id/HorizontalScrollView01"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:scrollbars="horizontal"
   >
   <TableLayout
    android:id="@+id/ItemPane"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#EEE"
   >
    <TableRow
     android:id="@+id/DataRow"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"    
     android:background="#888"
     android:layout_margin="0dp" 
     android:gravity="left"
     >
     <TextView
      android:id="@+id/NameField"
      android:text="Fieldname"
      android:background="#EEE"
      android:textSize="14dp"
      android:layout_margin="1dp" 
      android:layout_marginBottom="0dp" 
      android:paddingLeft="3dp"
      android:paddingRight="3dp"
     />
     <EditText
      android:id="@+id/DataField"
      android:text="some field"
      android:background="#EEE"
      android:textSize="14dp"
      android:layout_margin="1dp" 
      android:layout_marginBottom="0dp" 
      android:paddingLeft="3dp"
      android:paddingRight="3dp"
      android:singleLine="true"
     />
     <EditText
      android:id="@+id/DataField2"
      android:text="some longish field content..."
      android:background="#EEE"
      android:textSize="14dp"
      android:layout_margin="1dp" 
      android:layout_marginBottom="0dp" 
      android:paddingLeft="3dp"
      android:paddingRight="3dp"
      android:singleLine="true"
     />
    </TableRow>   
   </TableLayout>
  </HorizontalScrollView>
 </ScrollView>
</LinearLayout>

为什么TEXTSIZE属性中的EditText字段被忽略?我怎样才能使这些领域的文本更小,让所有的细胞具有相同的字体大小?为什么Android的没有兑现那个属性,即使明确设置?

Why is the textSize attribute ignored in EditText-fields? How can I make the text in those fields smaller, so that ALL cells have the same font size? Why does Android not honor that attribute, even if explicitly set?

迈克尔

推荐答案

我认为你应该使用DP的SP。
    机器人:TEXTSIZE =20SP

I think you should use sp instead of dp. android:textSize="20sp"

这篇关于Android的:如何改变一个EditText领域的TEXTSIZE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆