2014-03-31 39 views
0

我在android项目中设计了一个xml(在布局包中),我想让我的UI在任何Android移动设备和Android平板电脑上运行,如果设备大小更改我的UI显示良好,我使用LinearLayout在linearLayout3中,我有一个textview和一个EditText,当我运行程序时,从我的textview和linearLayout3中的EditText得到错误,错误是: “Binary XML file line#90:Error inflate class android.widget.EditText” Please向我建议解决我的问题的解决方案。 代码是:LinearLayout和Android UI的大小

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".MainActivitytest" > 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" > 

     <Button 
      android:id="@+id/btnstop" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="0dp" 
      android:drawableTop="@drawable/r_stop" 
      android:text="Stop" /> 

     <Button 
      android:id="@+id/btnstart" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="140dp" 
      android:drawableTop="@drawable/r_start" 
      android:text="Start" /> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/linearLayout1"> 

     <RadioGroup 
      android:id="@+id/radioGroup3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="20dp" 
      android:ems="150" 
      android:gravity="right" > 

      <RadioButton 
       android:id="@+id/Rb_Defualt" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:checked="true" 
       android:ems="150" 
       android:gravity="right" 
       android:text="testdefualt"/> 

      <RadioButton 
       android:id="@+id/Rb_Periodic" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:ems="150" 
       android:gravity="right" 
       android:text="testperiodic"/> 

      <RadioButton 
       android:id="@+id/Rb_Maual" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:ems="150" 
       android:fitsSystemWindows="true" 
       android:gravity="right" 
       android:text="testmanual" 
       android:visibility="visible" /> 

     </RadioGroup> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/linearLayout2" > 

     <TextView 
      android:id="@+id/TxtTime" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:ems="200" 
      android:textIsSelectable="true" 
      android:text="Please Enter Time"/> 

     <EditText 
      android:id="@+id/Txt_Minute_Periodic" 
      android:layout_width="0dip" 
      android:layout_marginLeft="-300dp" 
      android:layout_height="wrap_content" 
      android:paddingBottom="@+id/TxtTime" 
      android:layout_weight="50" 
      android:layout_marginTop="50dp" 
      android:inputType="number" /> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout4" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/linearLayout3" 
     android:layout_marginTop="60dp"> 

     <Button 
      android:id="@+id/btn_ok" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="0dp" 
      android:drawableTop="@drawable/r_ok" 
      android:text="ok" /> 

     <Button 
      android:id="@+id/btn_Config" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="30dp" 
      android:drawableTop="@drawable/r_config" 
      android:text="config" /> 

     <Button 
      android:id="@+id/btnkeyManagment" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="17dp" 
      android:drawableTop="@drawable/r_save" 
      android:maxLines="2" 
      android:text="key" /> 

</LinearLayout> 

</RelativeLayout> 
+0

为了解决你的问题,首先要隔离问题的根源。显然,一个编辑文本。首先尽可能多地去除元素,同时再现问题。这将减少搜索解决方案的代码量。那么它可能会跳到你身上。 – njzk2

回答

1

Android的:在你的EditText paddingBottom来场应该是一个数字,而不是一个ID。