I ein Layout mit PercentRelativeLayout als Stammansicht habe:layout_aspectRatio auf PercentRelativeLayout
<android.support.percent.PercentRelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_aspectRatio="178%">
<ImageView
android:id="@+id/firstImage"
app:layout_widthPercent="50%"
android:scaleType="centerCrop"
/>
<ImageView
android:id="@+id/secondImage"
app:layout_widthPercent="50%"
android:scaleType="centerCrop"
android:layout_toRightOf="@id/firstImage"
/>
</android.support.percent.PercentRelativeLayout>
was ich tun muß, um ein 16 festgelegt ist: 9-Seitenverhältnis auf die PercentRelativeLayout
und dann 2 Bilder haben (jeweils 50% breites) in der, so sieht es etwa so aus:
http://i.imgur.com/Iy8JiCQ.png
Aber wenn ich die app laufen, die beiden Bilder nicht auftauchen (als ob die Ansicht nicht existiert).
Was soll ich ändern, um zu bekommen, was ich brauche?
'App: layout_aspectRatio 'ist ein Attribut, das Sie auf die * Kinder * von' PercentRelativeLayout' anwenden, nicht auf das 'PercentRelativeLayout' selbst. – ianhanniballake
@ianhanniballake Das würde Sinn machen. Gibt es ein Layout/eine Methode zum Anwenden eines Seitenverhältnisses auf eine Elternansicht (wie ein RelativeLayout) und müssen sich die Kinder darauf einstellen? –
Sie können sicherlich ineinander verschachteln – ianhanniballake