我想创建一个布局来获得以下组织:
___________________________________
|BT TV ---------SP------------ TV BT|
------------------------------------
___________________________ _____
|--------PB-------- BT BT BT| |BT BT|
--------------------------- -----
BT: Button
TV: TextView
SP: Spinner
PB: ProgressBar
_
| |: layout
-
目前,我的问题是最后两个BT(linearLayoutGetPOI的右下角)是堆叠的,我找不到解决方法: 我选择使用RelativeLayout,因为我希望progressBar填充可用空间。
android:id="@+id/fragmentPlayMedias"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/relativeLayoutAudioControl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:background="@drawable/gradientbackground" >
<LinearLayout
android:id="@+id/linearLayoutPOIControl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/imageButtonPrevPOI"
android:layout_width="55dip"
android:layout_height="55dip"
android:layout_gravity="center_vertical"
android:contentDescription="@string/label_ImageButton_prevPOI_content_description"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:scaleType="centerInside"
android:src="@drawable/prevpoi_img" />
<TextView
android:id="@+id/textViewPrevPOI"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:text="00"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="@+id/spinnerPOI"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/textViewNextPOI"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:text="99"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="@+id/imageButtonNextPOI"
android:layout_width="55dip"
android:layout_height="55dip"
android:layout_gravity="center_vertical"
android:contentDescription="@string/label_ImageButton_nextPOI_content_description"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:scaleType="centerInside"
android:src="@drawable/nextpoi_img" />
</LinearLayout>
<RelativeLayout
android:id="@+id/linearLayoutAudioControl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/linearLayoutPOIControl"
android:layout_toLeftOf="@id/linearLayoutGetPOI" >
<ImageButton
android:id="@+id/imageButtonRewindMedia"
android:layout_width="55dip"
android:layout_height="55dip"
android:layout_marginLeft="20dp"
android:layout_toLeftOf="@id/imageButtonPlayPauseMedia"
android:contentDescription="@string/label_ImageButton_rewind_content_description"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:src="@drawable/rewind_img" />
<ImageButton
android:id="@+id/imageButtonPlayPauseMedia"
android:layout_width="55dip"
android:layout_height="55dip"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toLeftOf="@id/imageButtonForwardMedia"
android:contentDescription="@string/label_ImageButton_play_pause_content_description"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:src="@drawable/pause_img" />
<ImageButton
android:id="@+id/imageButtonForwardMedia"
android:layout_width="55dip"
android:layout_height="55dip"
android:layout_alignParentRight="true"
android:layout_marginRight="20dp"
android:contentDescription="@string/label_ImageButton_forward_content_description"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:src="@drawable/forward_img" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/imageButtonRewindMedia"
android:paddingLeft="6dp" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/linearLayoutGetPOI"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@id/linearLayoutPOIControl"
android:paddingRight="8dp" >
<ImageButton
android:id="@+id/imageButtonScan"
android:layout_width="55dip"
android:layout_height="55dip"
android:contentDescription="@string/label_ImageButton_scan_poi_content_description"
android:paddingBottom="8dp"
android:paddingLeft="10dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:scaleType="centerInside"
android:src="@drawable/qrcode" />
<ImageButton
android:id="@+id/imageButtonMap"
android:layout_width="55dip"
android:layout_height="55dip"
android:contentDescription="@string/label_ImageButton_poi_to_map_content_description"
android:paddingBottom="8dp"
android:paddingLeft="6dp"
android:paddingRight="8dp"
android:paddingTop="3dp"
android:scaleType="centerInside"
android:src="@drawable/icon_map" />
</RelativeLayout>
</RelativeLayout>
<!-- Other layouts-->
</LinearLayout>
那我的布局有什么问题?
此致
答案 0 :(得分:0)
您的左下方RelativeLayout的layout_width设置为&#34; match_parent&#34;意思是你的&#34; bunked&#34;相对布局未显示。
答案 1 :(得分:0)
<LinearLayout
android:id="@+id/fragmentPlayMedias"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
___________________________________
|BT TV ---------SP------------ TV BT|
------------------------------------
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margintop="10dp"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="250dp"
android:layout_height="wrap_content"
android:orientation="horizontal" >
___________________________
|--------PB-------- BT BT BT|
---------------------------
</LinearLayout>
<LinearLayout
android:layout_width="70dp"
android:layout_height="wrap_content"
android:layout_marginleft="10dp"
android:orientation="horizontal" >
|BT BT|
</LinearLayout>
</LinearLayout>
</LinearLayout>