2-14作业题

2-14作业题

在重复前两次的过程中 布局是正常的 但是当重复第三次时 布局就会变得特别奇怪 怀疑是weight只允许用两个控件来比 能否问问老师怎们解决 下面是我的第一轮的代码和布局结果 谢谢老师啦

 <LinearLayout 

       android:layout_width="match_parent" 

       android:layout_height="0dp"

       android:orientation="horizontal"

       android:layout_weight="1"

       >

       

       <LinearLayout 

           android:layout_width="0dp"

           android:layout_height="match_parent"

           android:orientation="vertical"

           android:layout_weight="1"

             >

           

           

       <TextView 

           android:layout_width="match_parent"

           android:layout_height="0dp"

           android:text="此处为图书封面"

           android:background="#7ba8b0"

           android:layout_gravity="top|left"

           android:layout_weight="2"

           />

           

       <TextView 

           android:layout_width="match_parent"

           android:layout_height="2dp"

           android:background="#baccde"

           />

       

       <TextView 

           android:layout_width="match_parent"

           android:layout_height="0dp"

           android:text="书名"

           android:background="#bfd9d4"

           android:gravity="top|left"

           android:layout_weight = "1"

           />

       

        <TextView 

           android:layout_width="match_parent"

           android:layout_height="2dp"

           android:background="#baccde"

           />

        

        

        

        

        

        </LinearLayout>

        

        <LinearLayout 

           android:layout_width="2dp"

           android:layout_height="match_parent"

           android:background="#7489ab"

      

           ></LinearLayout>

        

        

        

        

        

        

        

        

        

            <LinearLayout 

           android:layout_width="wrap_content"

           android:layout_height="match_parent"

           android:orientation="vertical"

           android:layout_weight="2"

           >

           

           <TextView 

               android:layout_width="match_parent"

               android:layout_height="0dp"

               android:text="概述"

               android:background="#bfd9d4"

               android:layout_gravity="top|right"

               android:layout_weight="1"/>

           

            <TextView 

               android:layout_width="match_parent"

               android:layout_height="2dp"

               android:background="#2e4d5c"/>

            

            <TextView 

               android:layout_width="match_parent"

               android:layout_height="0dp"

               android:text="作者"

               android:background="#bfd9d4"

               android:layout_gravity="top|right"

               android:layout_weight="1"/>

           

            <TextView

                android:layout_width="match_parent"

                android:layout_height="2dp"

                android:background="#2e4d5c" />


            <TextView 

               android:layout_width="match_parent"

               android:layout_height="wrap_content"

               android:text="日期"

               android:background="#bfd9d4"

               android:layout_gravity="top|right"

               android:layout_weight="1"/>

           

            <TextView 

               android:layout_width="match_parent"

               android:layout_height="2dp"

               android:background="#2e4d5c"/>

       </LinearLayout>

        

        

        

       

    </LinearLayout>

    

http://img1.sycdn.imooc.com/climg//59c5d4390001995e06370496.jpg

http://img1.sycdn.imooc.com/climg//59c5d2750001ec9706370496.jpg


正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
irista23 2017-09-23 23:58:12

weight是可以使用多个控件来标识显示的权重的,建议你可以把作业提交上来,有完整布局代码方便我们帮你查找问题解决。每个作业有两次提交机会。祝:学习愉快~

问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星

相似问题

登录后可查看更多问答,登录/注册

请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师