定義了如何布局,為何linearlayout和最后的button顯示不出來,如何才能顯示
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="38dp"
android:background="@drawable/bg_top">
<Button
android:id="@+id/exit"
android:layout_width="15dp"
android:layout_height="15dp"
android:layout_centerVertical="true"
android:layout_marginLeft="18dp"
android:background="@drawable/selector_exit" />
。。。
</RelativeLayout>
<RelativeLayout
android:layout_below="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<com.dazzle.note.view.NoteBook//自定義的surfaceview
android:id="@+id/note_book"
android:layout_below="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#20CFE6" />
</RelativeLayout>
<LinearLayout
android:id="@+id/btn_list"
android:layout_width="33dp"
android:layout_height="155dp"
android:orientation="vertical"
android:background="@drawable/btn_list_bg"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:layout_below="@+id/title" >
<Button
android:id="@+id/pen"
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginTop="17dp"
android:layout_marginLeft="6dp"
android:background="@drawable/selector_pen"
/>
<Button
android:id="@+id/import_whiteboard"
android:layout_width="21dp"
android:layout_height="21dp"
android:layout_marginTop="13dp"
android:layout_marginLeft="6dp"
android:background="@drawable/selector_import"
/>
</LinearLayout>
<Button
android:id="@+id/scale2"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_gravity="end"
android:layout_marginBottom="5dp"
android:layout_marginRight="5dp"
android:background="@drawable/selector_scale" />
<!--</android.support.v7.widget.ContentFrameLayout>-->
</RelativeLayout>
uj5u.com熱心網友回復:
被LinnerLayout上面那個RelativeLayout蓋住了uj5u.com熱心網友回復:
我在后面三個notebook LinnerLayout button套個framelayout還不行,如何才能顯示
uj5u.com熱心網友回復:
感覺你這個布局寫的有點復雜了,你顯示不全就是超出螢屏了,可以采取相對布局替代線性布局,要么就先將線性布局的高度調低一點做個兼容,望采納uj5u.com熱心網友回復:
id為title的RelativeLayout,即LinearLayout上一個RelativeLayout高度設定為wrap_content,非match_parent,不然你后面的布局怎么設定都會被覆寫,顯示不出來uj5u.com熱心網友回復:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/parent"
>
<RelativeLayout
android:id="@+id/title" 一號
</RelativeLayout>
<RelativeLayout
android:layout_below="@+id/title" 二號
</RelativeLayout>
<LinearLayout
android:id="@+id/btn_list"
android:layout_below="@+id/title" 三號
</LinearLayout>
<Button/> 四號
</RelativeLayout>
上面是你的布局簡單的模型,二號和三號 你都使用了layout_below title ,那么,按照渲染順序,應該是不會遮擋LinnerLayout,但是你的二號里面包含的是一個自定的view,所以問題出在這里。
然而解決問題不是從這里入手,而是要從布局入手。
既然你的二號和三號都below 一號title,何不使用FrameLayout包裹二號和三號呢,然后給三號設定成最上層就好了嘛。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/105501.html
標籤:Android
上一篇:通過微信號或者wxid如何生成微信二維碼,求大神賜教,有重謝!通過微信號或者wxid如何生成微信二維碼,求大神賜教,有重謝!
