android - 用shape写的一个有四个圆角的长方形,在xml中给LinearLayout设置了background没用??
迷茫
迷茫 2017-04-17 17:41:11
0
2
865

<shape xmlns:android="http://schemas.android.com/ap...

<stroke
    android:width="1dp"
    android:color="@color/white"/>

<solid
    android:color="@color/white"/>

<corners
    android:topLeftRadius="4dp"
    android:topRightRadius="4dp"
    android:bottomLeftRadius="4dp"
    android:bottomRightRadius="4dp"/>

</shape>

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

android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ScrollView

   android:layout_width="match_parent"
   android:layout_height="match_parent">
   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:orientation="vertical">

       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:orientation="vertical"
           android:background="@drawable/background_white"
           >
           <RelativeLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:paddingLeft="8dp"
               >

               <ImageView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_Portrait"
                   android:layout_width="50dp"
                   android:layout_height="50dp"
                   android:layout_marginTop="10dp"
                   android:layout_marginBottom="10dp"
                   android:background="@mipmap/photo_normal"
                   />

               <TextView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyName"
                   android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_Portrait"
                   style="@style/TextView_16sp_black"
                   android:layout_marginTop="10dp"
                   android:singleLine="true"
                   android:text="杭州中艺生态环境工程有限公司"
                   android:maxEms="14"
                   android:ellipsize="end"
                   android:layout_marginLeft="12dp"/>

               <ImageView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_Accreditation"
                   android:layout_marginTop="4dp"
                   style="@style/ImageView_WrapContent"
                   android:layout_alignTop="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyName"
                   android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyName"
                   android:layout_marginLeft="8dp"
                   android:background="@mipmap/authenticated"
                   />

               <TextView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyQuality"
                   android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_Portrait"
                   android:layout_below="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyName"
                   style="@style/TextView_14sp_UserPersonalCenter_TextColor"
                   android:layout_marginTop="6dp"
                   android:text="私营企业/50人以下"
                   android:layout_marginLeft="12dp"/>

               <ImageView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyCategory"
                   style="@style/ImageView_WrapContent"
                   android:layout_marginTop="3dp"
                   android:layout_alignTop="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyQuality"
                   android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyQuality"
                   android:layout_marginLeft="8dp"
                   android:background="@mipmap/headhunter"/>
           </RelativeLayout>

           <View
               style="@style/Long_Separator_DashLine"/>

           <LinearLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:orientation="horizontal"
               android:paddingTop="17dp"
               android:paddingBottom="17dp">
               <TextView
                   style="@style/TextView_16sp_black"
                   android:text="@string/CompanyAddress"
                   android:paddingLeft="11dp"/>
               <TextView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyAddress"
                   style="@style/TextView_16sp_black"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:paddingLeft="8dp"
                   android:text="浙江省杭州市江干区秋涛路233号"
                   android:background="@color/white"
                   />
           </LinearLayout>
       </LinearLayout>
       <LinearLayout
           android:layout_marginTop="8dp"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:orientation="vertical"
           android:background="@drawable/background_white">
           <TextView
               style="@style/TextView_16sp_black"
               android:layout_width="match_parent"
               android:layout_height="42dp"
               android:paddingLeft="11dp"
               android:text="@string/CompanyIntroduce"
               android:gravity="center_vertical|start"
               android:background="@color/white"
               android:textStyle="bold"/>

           <View
               style="@style/Long_Separator_DashLine"/>

           <TextView
               android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyDescribe"
               style="@style/TextView_14sp_gray"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:background="@color/white"
               android:lineSpacingExtra="12dp"
               android:paddingTop="14dp"
               android:paddingLeft="11dp"
               android:paddingRight="16dp"
               android:paddingBottom="20dp"
               />
       </LinearLayout>
       <LinearLayout
           android:layout_marginTop="8dp"
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:background="@drawable/background_white"
           android:orientation="vertical">
           <TextView
               style="@style/TextView_16sp_black"
               android:layout_width="match_parent"
               android:layout_height="42dp"
               android:paddingLeft="11dp"
               android:text="@string/ContactWay"
               android:gravity="center_vertical|start"
               android:background="@color/white"
               android:textStyle="bold"/>

           <View
               style="@style/Long_Separator_DashLine"/>
           <RelativeLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:paddingLeft="11dp"
               android:paddingTop="10dp"
               android:paddingBottom="15dp"
               android:background="@color/white"
               >

               <TextView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_Contacts"
                   style="@style/TextView_14sp_gray"
                   android:text="@string/Contact"/>
               <TextView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsName"
                   android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_Contacts"
                   android:layout_alignTop="@id/JobWanted_CompanyDetails_CompanyInformationfragment_Contacts"
                   style="@style/TextView_14sp_gray"
                   android:layout_marginLeft="12dp"
                   />

               <TextView
                   android:layout_below="@id/JobWanted_CompanyDetails_CompanyInformationfragment_Contacts"
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsPhone"
                   style="@style/TextView_14sp_gray"
                   android:layout_marginTop="12dp"
                   android:text="@string/ContactPhone"/>

               <TextView
                   android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsPhoneNumber"
                   android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsPhone"
                   android:layout_alignTop="@id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsPhone"
                   style="@style/TextView_14sp_gray"
                   android:layout_marginLeft="12dp"
                   />

                   <TextView
                       android:layout_below="@id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsPhone"
                       android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyWebsite"
                       style="@style/TextView_14sp_gray"
                       android:layout_marginTop="12dp"
                       android:text="@string/CompanyWeb"/>

                   <TextView
                       android:id="@+id/JobWanted_CompanyDetails_CompanyInformationfragment_ContactsWebsiteName"
                       android:layout_toRightOf="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyWebsite"
                       android:layout_alignTop="@id/JobWanted_CompanyDetails_CompanyInformationfragment_CompanyWebsite"
                       style="@style/TextView_14sp_gray"
                       android:layout_height="wrap_content"
                       android:layout_marginLeft="12dp"
                       />
           </RelativeLayout>
       </LinearLayout>

   </LinearLayout>

</ScrollView>
</LinearLayout>

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

répondre à tous(2)
黄舟

感觉你可以改一下shape 中solid的颜色换成其他的颜色比如红色,看看效果咋样

黄舟

最好把你怎么使用这个布局的代码发出来

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal