0
我有兩個帶圓角的線性佈局,如下面的代碼所示;Android LinearLayout在另一個線性佈局
我想要實現的是linearlayout內部的線性佈局,但是頂部的外部佈局邊界強制一個間隙,以便我可以輸入文本。內部看起來像內部佈局有一個黑暗的邊界。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/loginbackground" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="62dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="5dip"
android:background="@drawable/rounded_rectangle_dark"
android:orientation="vertical"
>
<!-- TextView goes here -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dip"
android:background="@drawable/rounded_rectangle_white"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:scaleType="fitCenter"
android:src="@drawable/icon_contact" />
<EditText
android:id="@+id/login_username_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:hint="@string/login_username_hint"
android:inputType="textEmailAddress"
android:text="[email protected]" >
<!-- <requestFocus />-->
</EditText>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- End of Inner Layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginTop="10dp"
android:orientation="vertical" >
<Button
android:id="@+id/login_btn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/red_button"
android:textStyle="bold"
android:textSize="25sp"
android:text="@string/login_login_btn"
android:textColor="@color/solid_white" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
這裏的色彩風格;
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<solid android:color="#ffffff"/>
<stroke android:width="1dp"
android:color="#2B3856"/>
<corners android:radius="20dp"/>
</shape>
任何幫助表示讚賞。
那正是進出口尋找......如果可能的話,這將是非常高興看到的代碼? – user1859465
當然沒問題,我已經編輯了答案。 –