<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:text="@string/welcome"
android:id="@+id/TextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
<LinearLayout android:id="@+id/LinearLayout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="bottom">
<EditText android:id="@+id/EditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</EditText>
<Button android:text="@string/label_submit_button"
android:id="@+id/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
</LinearLayout>
이 같은 it looks like 는 왼쪽에, 내가 원하는 것이 무엇인지 어떻게 보면 오른쪽에 있다.
! [안드로이드 레이아웃뿐만 - 실제 (왼쪽) 및 원하는 (오른쪽)] [1]
명백한 답이 될 수 있지만, 이로 인해 fill_parent 테스트비에프 설정할 수 있는 공간이 없는 것으로 높이 단추나 입력 필드를 떠났다.
이 문제를 근본적으로 해결할 수 있는 것은 내가 다운로드하려는 onsubmit 버튼 및 텍스트 입력 및 텍스트 보기입니다 칠하려면 맨 아래에 있는 높이 나머지 공간. 마찬가지로 내가 수펑 일괄이라는 레이아웃뿐만 다운로드하려는 제출] 을 해당 콘텐츠 및 랩 텍스트의 엔트리급에서 칠합니다 미삭 공간.
첫 번째 항목은 는 선형 레이아웃뿐만 리즈한테 fill_parent 수 있는 경우, 다른 항목에 대해 정확히 않니다 것가운데 여지가 없습니다. 첫 번째 항목을 어떻게 구입합니까 원하는거요 선형으로 레이아웃뿐만 모든 공간을 별도로 요구하는 최소값이 칠하려면 미삭 있는 항목의 레이아웃뿐만?
< hr/>;
그러나 상대 레이아웃 pokemonsilver. 대답:
<?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">
<TextView
android:text="@string/welcome"
android:id="@+id/TextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
</TextView>
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<Button
android:text="@string/label_submit_button"
android:id="@+id/Button"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</Button>
<EditText
android:id="@+id/EditText"
android:layout_width="fill_parent"
android:layout_toLeftOf="@id/Button"
android:layout_height="wrap_content">
</EditText>
</RelativeLayout>
</RelativeLayout>
[1]: https://lh4.ggpht.com/_EW60jqE5_B0/S5D_wMGvK7I/AAAAAAAAALs/p5YdtjqMr-E/s800/Android% 20layout.png
이를 위해서는 현대 운행에서어떠한 투명지에 콘스트라인트레이우스 및 constrain 볼 수 있는 ',' , 로 콘스트라인트레이우스 하단에 " parent" app:layout_constraintBottom_toBottomOf =
아래 예제는 것으로 최종 및 화면 하단에 정렬되고 플로팅스션버튼 만듭니다.
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent">
<android.support.design.widget.FloatingActionButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</android.support.constraint.ConstraintLayout>
참고로, 내가 새벽꺼정 내 예전 그 답이 있다.
Answer 는 도입 전에 콘스트라인트레이우스 상대치 레이아웃뿐만.
상대 레이아웃뿐만 칠하는 경우 화면 전체를 사용할 수 있어야 합니다 ['android:layout_alignParentBottom'] [3] 버튼이 이동합니까 화면 하단에.
맨 아래에 나와 있는 경우 보기 이상의 않습니다를 상대 레이아웃뿐만 아마도 모든 공간을) 이 걸린다. 이 경우, 맨 먼저 할 수 있는 동일팔레트에 보기입니다 레이아웃에 포지셔닝해야 파일이므로 미삭 레이아웃 android:layout_above 의견을 '위에'. 이를 통해 볼 수 있는 공간을 필요로 하는 것처럼, 많은 시행하십시오, 나머지 모든 미삭 화면 레이아웃 채울 수 있습니다.
[3]: http://developer.android.com/reference/android/widget/RelativeLayout.LayoutParams.html # attr_android:layout_alignParentBottom
내가 고정식입니다 사용해 그 무중단으로 프라메라리우스 스트레치할 '':
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:fillViewport="true">
<LinearLayout
android:id="@+id/LinearLayout01"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
<!-- content goes here -->
<!-- stretching frame layout, using layout_weight -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</FrameLayout>
<!-- content fixated to the bottom of the screen -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<!-- your bottom content -->
</LinearLayout>
</LinearLayout>
</ScrollView>
초기 일괄이라는 중첩하면 레이아웃용 일괄이라는 내의 상대 레이아웃뿐만 레이아웃용 상태로 유지할 수 있습니다.
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:text="welcome"
android:id="@+id/TextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
</TextView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button android:text="submit"
android:id="@+id/Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true">
</Button>
<EditText android:id="@+id/EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/Button"
android:layout_alignParentBottom="true">
</EditText>
</RelativeLayout>
</LinearLayout>
정답은 # 39 위 (대표 야누쉬) 는 상당히 정확하지만, 함께 느낄 수 없다, 그래서 내가 페르송널리 don& 편하지 100% # 39, & # 39, filler& 포지셔닝하십시오 레이티벨라유츠 도입을 위해 빈 테스트비에프 (예:
<!-- filler -->
<TextView android:layout_height="0dip"
android:layout_width="fill_parent"
android:layout_weight="1" />
화면 하단의 요소를 전에 합니다.
이 역시 작동합니다.
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="@+id/linearLayout3"
android:layout_centerHorizontal="true"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_marginTop="20dp"
>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
/>
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
/>
</LinearLayout>
및 세트 ',' 을 사용하면, parent" app:layout_constraintBottom_toBottomOf = " 레이아웃용 화면 하단에서:
<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent">
</LinearLayout>
그냥 '세트' android:layout_gravity = 레이아웃에 bottom" ";
<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal">
</LinearLayout>
<TextView
android:id="@+id/TextView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="welcome" />
기본 속성은 ',' 자, 그럼, 중력 드로이드: = " bottom" 바닥에 보기입니다 레이아웃용.
<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="bottom"
android:orientation="horizontal">
</LinearLayout>
및 세트 ',' = " android:layout_alignParentBottom true" 수 있도록 화면 하단에 있는 레이아웃이.
<LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal">
</LinearLayout>
다음과 같은 층에 [Timores& # 39 의 우아한 솔루션이므로] [1] 나는 수직 및 수평 수직 린얼리우스 칠 수 있는 것은 다음 tcpg 채우고 있는 수평 린얼리우스:
<Space
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
[1]: # 5694449 https://stackoverflow.com/questions/2386866/how-do-i-align-views-at-the-bottom-of-the-screen/5694449
android:layout_weight="1"
id 를 가진 테스트비에프 이리에 @+id/TextView '대한'
<TextView android:text="@string/welcome"
android:id="@+id/TextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</TextView>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/backgroundcolor"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#FF0000">
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#FFFF00">
</RelativeLayout>
</RelativeLayout>
아래 코드를. 버튼이 맞추십시오 보텀. # 39 의 it& 작업 중.
<?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" >
<Button
android:id="@+id/btn_back"
android:layout_width="100dp"
android:layout_height="80dp"
android:text="Back" />
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.97"
android:gravity="center"
android:text="Payment Page" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Submit"/>
</LinearLayout>
</LinearLayout>
이 같은 사건을 항상 flfile. 레이티벨라유츠. 이러한 현세생 린얼리우스 한 것이 아닙니다.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/db1_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- Place your layout here -->
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:orientation="horizontal"
android:paddingLeft="20dp"
android:paddingRight="20dp" >
<Button
android:id="@+id/setup_macroSavebtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Save" />
<Button
android:id="@+id/setup_macroCancelbtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Cancel" />
</LinearLayout>
</RelativeLayout>
다음과 같은 계층 구조를 가지고 있는 경우
<ScrollView>
|-- <RelativeLayout>
|-- <LinearLayout>
첫째, ',' 다음 ',' 을 적용하십시오 안드로이드 필비에프포트 = " true" 스테롤비에프 ',', '을 적용하십시오 android:layout_alignparentbottom = " true" 린얼리우스'.
이 협력했습니다 가져다줄래요 완벽하게.
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:scrollbars="none"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:id="@+id/linearLayoutHorizontal"
android:layout_alignParentBottom="true">
</LinearLayout>
</RelativeLayout>
</ScrollView>
너무 일괄이라는 레이아웃뿐만 함께 이 작업을 수행할 수 있습니다.
그냥 1 위, 레이아웃, 무게 = Height = 0dp 제공하십시오 운영까지도 1 회말. 그냥 쓰기 height = 랩 컨텐츠 및 아무런 가치도.
또한 랩 컨텐트입니다 레이아웃 (들어 있는 한 텍스트 편집 및 버튼) 와 다음 방정식입니다 무게:3.67kg 미삭 레이아웃 꽂혀 있다.
내가 이 우연히 발견했다.