2017-08-07 199 views
0

我已經創建了一個佈局。但在底部還剩下一片空白。我想要在屏幕最底部的相對佈局的內容。即搜索欄和按鈕在底部。佈局不適合屏幕

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:background="@drawable/images"> 

<com.example.acer.myapplication.ZoomView 
    android:id="@+id/iop" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:gravity="center"/> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 
    <SeekBar 
     android:id="@+id/seekBar7" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 
    <Button 
     android:id="@+id/button61" 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_below="@id/seekBar7" 
     android:layout_centerInParent="true" 
     android:background="@drawable/play" /> 
</RelativeLayout> 
</LinearLayout> 

我想把底部的空白處換成相對佈局的內容。 我已經上傳圖像

回答

2

使用此代碼:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:orientation="vertical" 
android:background="@drawable/images"> 

<com.example.acer.myapplication.ZoomView 
    android:id="@+id/iop" 
    android:layout_width="match_parent" 
    android:layout_height="0dp" 
    android:layout_weight="1" 
    android:gravity="center"/> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
android:layout_alignParentBottom="true" 
> 
    <SeekBar 
     android:id="@+id/seekBar7" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 
    <Button 
     android:id="@+id/button61" 
     android:layout_width="50dp" 
     android:layout_height="50dp" 
     android:layout_below="@id/seekBar7" 
     android:layout_centerInParent="true" 
     android:background="@drawable/play" /> 
</RelativeLayout> 
</RelativeLayout> 
+0

請勾選我的答案,如果它爲你工作...... thanx。 –

+0

它的工作.....謝謝 – Devk

+0

請打勾我的回答 –