2017-02-14 51 views
0

This is my layout。我的问题是,该ID是“below_button”LinearLayout无效,在手机上运行。手机没有显示这个LinearLayout,但其他人的布局是正确的。怎么来的?为什么layout_below在手机上运行无效?

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent"> 

    <include 
     android:id="@+id/title" 
     layout="@layout/toptitlebar" /> 

    <LinearLayout 
     android:id="@+id/query_detail" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_below="@+id/title" 
     android:background="#e2dfdf" 
     android:layout_alignParentLeft="true"> 
     <EditText 
      android:id="@+id/ram_assistinqnum" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_margin="10dp" 
      android:layout_weight="0.45" 
      android:hint="通知书编号" 
      android:maxLines="1" 
      /> 
     <TextView 
      android:id="@+id/ram_operate_date" 
      style="@style/SpinnerCtl_Wrap" 
      android:gravity="center" 
      android:layout_margin="10dp" 
      android:layout_weight="0.45" 
      android:hint="操作时间" 
      android:textColor="@color/black"/> 
     <ImageView 
      android:id="@+id/ram_query" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center" 
      android:layout_weight="0.1" 
      android:src="@drawable/ram_querry" 
      android:layout_margin="10dp"/> 
    </LinearLayout> 

    <com.sdrcu.operatingdecisions.view.scrollabletbv.ScrollTableView4 
     android:id="@+id/scrollTableView" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@id/query_detail" 
     /> 

    <LinearLayout 
     android:id="@+id/below_button" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:background="#e2dfdf" 
     android:layout_below="@+id/scrollTableView" 
     > 
     <ImageView 
      android:id="@+id/ram_arrow_previous" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:scaleType="center" 
      android:layout_weight="0.3" 
      android:src="@drawable/ram_arrow_previous"/> 
     <TextView 
      android:id="@+id/paging" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.3" 
      android:gravity="center" 
      android:text="翻页" 
      android:textColor="@color/text_blue" 
      android:textSize="20sp" 
      /> 
     <ImageView 
      android:id="@+id/ram_arrow_next" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:scaleType="center" 
      android:layout_weight="0.3" 
      android:src="@drawable/ram_arrow_next"/> 
     <ImageView 
      android:id="@+id/ram_agree" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.1" 
      android:src="@drawable/ram_agree"/> 
     <ImageView 
      android:id="@+id/ram_disagree" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.1" 
      android:src="@drawable/ram_disagree"/> 

    </LinearLayout> 

</RelativeLayout> 

回答

0

@Seal

在我的布局编辑器的预览我改变了“主题编辑器中”,以“主题”
我开始得到错误像你的截图一样。

参见:

enter image description here


所以,我选择了 “全部” - > “AppTheme”,从 “主题编辑器中的” 选项...不要忘了按 “OK”

enter image description here


而错误去的时候

enter image description here

那么,你为什么不也尝试将其设置为“所有” - >“AppTheme”


而且在我看来,你可能已经创建的样式( s)不从“适当的父母”继承。

使用例如以下: “AppTheme” 继承 “Theme.AppCompat.Light.DarkActionBar” 所有必需的属性。因此,你只需要指定你需要修改的属性。

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    ... 

    <item name="colorAccent">@color/colorAccent</item> 

    ... 
</style> 
+0

我没有错过这两个属性。我用这个样式引用了SpinnerCtl_Wrap的布局。 – Seal

+0

@Seal我刚刚在Android设备上添加了这个布局的“截图”。你在Android设备上看到了相同的内容吗? (显然我已经注释掉了com.sdrcu.operatingdecisions.view.scrollabletbv.ScrollTableView4,因为我没有这个类) –

+0

是的,“ScrollTableView4”是我定义的类。我该怎么做?对不起,我是一位新的Android开发者!谢谢! – Seal

0

更换

android:layout_below="@id/query_detail" 

<com.sdrcu.operatingdecisions.view.scrollabletbv.ScrollTableView4 
    android:id="@+id/scrollTableView" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/query_detail" 
    /> 

android:layout_below="@+id/query_detail" 
0

是你错过了参数身高和体重

android:layout_width="match_parent" 
android:layout_height="wrap_content" 

添加在布局它的工作原理Use the Tag

相关问题