對於我的應用程序,我製作一個屏幕,您可以在其中查看有關商店的信息。這就是我現在得到的(在下面的圖片中)剩餘的區域,我想填寫一個圖像或谷歌地圖視圖。是否有可能通過xml填充剩餘區域?或者我該如何解決這個問題?Android佈局對齊並填充視圖中的剩餘空間
第二個問題是: 正如你可以在白色區域看到的圖標或很好的居中。我想將它上面的塊上的圖標與白色框中圖標的左側對齊。我該怎麼做呢?
代碼:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
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/winkels_uren_bg"
android:paddingTop="25dp"
android:paddingBottom="25dp"
android:paddingLeft="35dp">
<TextView
android:id="@+id/lblStraat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/map"
android:gravity="center_vertical"
android:paddingBottom="15dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/telefoonnr"
android:drawableLeft="@drawable/telefoon_icon"
android:gravity="center_vertical"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#FFFFFF"
android:gravity="center_horizontal">
<LinearLayout
style="@style/winkelinfoicons">
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icobancontact"
android:background="@null"
/>
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icomarkt"
android:background="@null"
/>
</LinearLayout>
<LinearLayout
style="@style/winkelinfoicons">
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icoeducatie"
android:background="@null"
/>
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icomobielestand"
android:background="@null"
/>
</LinearLayout>
<LinearLayout
style="@style/winkelinfoicons">
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icogeschenken"
android:background="@null"
/>
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icovoeding"
android:background="@null"
/>
</LinearLayout>
<LinearLayout
style="@style/winkelinfoicons">
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icoklasbezoek"
android:background="@null"
/>
<ImageButton
style="@style/winkelinfoicon"
android:id="@+id/icowinkel"
android:background="@null"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
其實我的工作與包括但現在我在這裏粘貼完整的XML :)。
使用相對佈局。 – Akram 2012-03-04 16:52:13
我想要定位多個屏幕大小。而且我總是擔心在不同的屏幕上它不會一樣。或者不會有問題? – 2012-03-04 16:55:00
只有硬編碼佈局文件時纔會出現問題。 – Akram 2012-03-04 16:58:41