本人菜鸟,刚刚开始学着写第一个android app 遇到一个也许是很菜的问题,但是被纠结了一天都没搞出来,麻烦大神指点下。
我的目的是想让home 和favorite 两个按钮居中,play按钮靠右,但是试了好多办法都调不到我想要的位置上。
界面截图:
代码如下:
<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="match_parent"
android:background="@drawable/background"
android:layout_gravity="center_vertical"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal"
android:background="@drawable/nav_bar_background_img_2x"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:orientation="horizontal" >
<Button
android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/nav_main_selected_2x" />
<Button
android:id="@+id/favorite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/nav_favorite_2x" />
</LinearLayout>
<Button
android:id="@+id/playlist"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="right"
android:layout_marginRight="5dp"
android:background="@drawable/popview_playbtn_2x" />
</LinearLayout>
<com.org.happyenglish.service.list.ItemListView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>