【问题标题】:issue with eclipse and layouts日食和布局问题
【发布时间】:2012-03-11 06:00:44
【问题描述】:

当我在布局文件夹(中型设备)中更改某些内容并返回到 layout-xlarge 文件夹时,一些值会发生变化。

换句话说,当我更改布局文件夹中的一个文件时,layout-xlarge 文件夹中的另一个文件也发生了更改,存在无限循环循环,我无法设置正确分辨率的值。我该如何解决?这是什么?

例如这两个变化: 在布局文件夹中:

<AutoCompleteTextView android:id="@+id/atxt"
        android:layout_width="250dp"
        android:layout_height="57dp"
        android:layout_marginTop="70dp"
        android:layout_marginLeft="10dp" android:gravity="left" android:textSize="35dp"/>

改为:

<AutoCompleteTextView android:id="@+id/atxt"
        android:layout_width="410dp"
        android:layout_height="57dp"
        android:layout_marginTop="100dp"
        android:layout_marginLeft="10dp" android:gravity="left" android:textSize="35dp"/>

【问题讨论】:

    标签: java android eclipse layout android-2.2-froyo


    【解决方案1】:

    将所有值放在维度中。 例如 res/values/dimen.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <dimen name="atxt_width">250dp</dimen>
    </resources>
    

    res/values-xlarge/dimen.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
        <dimen name="atxt_width">410dp</dimen>
    </resources>
    

    并将 layout.xml 设置为 atxt_width - 变量:

    @dimen/atxt_width" android:layout_height="57dp" android:layout_marginTop="70dp" android:layout_marginLeft="10dp" android:gravity="left" android:textSize="35dp"/>

    【讨论】:

      猜你喜欢
      • 2014-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-03
      • 1970-01-01
      • 2018-05-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多