我是个菜鸟 在网上下载了一段代码 ,源码的效果 如图
原代码 :
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/background_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/bg_01"
android:visibility="visible" /> <TextView
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:visibility="gone" /> <!-- 这是第一个LinearLayout-->
<LinearLayout
android:id="@+id/root_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0"
> <!--这是内容LinearLayout-->
<LinearLayout
android:id="@+id/fragment_up_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_weight="0.35" >
</LinearLayout>
<!-- 这是菜单LinearLayout-->
<LinearLayout
android:id="@+id/fragment_down_layout"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_weight="0.65"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:name="com.example.testfragmentsplit.FragmentDown"
android:id="@+id/fragment_down"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>现在我想将 下面这行菜单换到左边 于是 我将第一个 LinearLayout 的orientation设置成横向排列“horizontal" ; 再将 菜单LinearLayout 移到 内容LinearLayout 上面 结果如图:这这。。 右边内容没有了 好像是被菜单层遮住了 我不知道怎么改 ,我要菜单到左边,右边显示内容,谢谢大家
原代码 :
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/background_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/bg_01"
android:visibility="visible" /> <TextView
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:visibility="gone" /> <!-- 这是第一个LinearLayout-->
<LinearLayout
android:id="@+id/root_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1.0"
> <!--这是内容LinearLayout-->
<LinearLayout
android:id="@+id/fragment_up_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="horizontal"
android:layout_weight="0.35" >
</LinearLayout>
<!-- 这是菜单LinearLayout-->
<LinearLayout
android:id="@+id/fragment_down_layout"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_weight="0.65"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:name="com.example.testfragmentsplit.FragmentDown"
android:id="@+id/fragment_down"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
</FrameLayout>现在我想将 下面这行菜单换到左边 于是 我将第一个 LinearLayout 的orientation设置成横向排列“horizontal" ; 再将 菜单LinearLayout 移到 内容LinearLayout 上面 结果如图:这这。。 右边内容没有了 好像是被菜单层遮住了 我不知道怎么改 ,我要菜单到左边,右边显示内容,谢谢大家
<LinearLayout
android:id="@+id/fragment_down_layout"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_weight="0.65"
android:layout_width="match_parent"
android:layout_height="match_parent">目测是这里,你的菜单layout的宽,设置成填充满父控件了。
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/FrameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" > <ImageView
android:id="@+id/background_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/bk"
android:visibility="visible" /> <TextView
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
android:visibility="gone" />
<!-- 这是第一个LinearLayout --> <LinearLayout
android:id="@+id/root_ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="1.0" > <!-- 这是菜单LinearLayout --> <LinearLayout
android:id="@+id/fragment_down_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.65"
android:gravity="center_vertical"
android:orientation="horizontal" > <fragment
android:id="@+id/fragment_down"
android:name="com.example.testfragmentsplit.FragmentDown"
android:layout_width="0px"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
<!-- 这是内容LinearLayout --> <LinearLayout
android:id="@+id/fragment_up_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.35"
android:gravity="center_vertical"
android:orientation="horizontal" >
</LinearLayout>
</LinearLayout></FrameLayout>是这样的效果吗,我按你说的方法弄上去,没发现遮盖什么的啊
你把这个:
<!-- 这是菜单LinearLayout -->
<LinearLayout
android:id="@+id/fragment_down_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.65"
android:gravity="center_vertical"
android:orientation="horizontal" >里面的android:layout_weight="0.65"去掉
android:layout_width="match_parent"的值换成“100”看看效果呢。你要学习找错的方法每个可能错的值都换换看,看看效果。