嗨即時嘗試設計我的應用程序的Android手機和平板電腦。所以我已經設計了它,但需要重新設計以適應不同屏幕的縮放目的。在同一屏幕上的兩個線性佈局
這是佈局我去了。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/white">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="2"
android:orientation="horizontal" >
<fragment
android:id="@+id/map"
android:layout_marginTop="5dp"
android:layout_weight=".1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.MapFragment"
/>
<Button
android:id="@+id/button3"
android:layout_weight=".25"
android:layout_marginLeft="34dp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="ClickTourismButton"
android:text="@string/Tourism" />
<Button
android:id="@+id/button4"
android:layout_weight=".25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="34dp"
android:text="@string/Nearby" />
<Button
android:id="@+id/button2"
android:layout_weight=".25"
android:layout_marginLeft="34dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Favourites" />
<Button
android:id="@+id/button1"
android:layout_weight=".25"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="34dp"
android:text="@string/Map" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="2"
android:orientation="horizontal" >
<TextView
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:id="@+id/feedupdate1" />
<ListView
android:id="@android:id/list"
android:background="@color/red"
android:layout_weight="1"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"/>
<TextView
android:id="@+id/empty"
android:textIsSelectable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"/>
<TextView
android:id="@+id/feedupdate"
android:layout_marginLeft="6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="430dp"
android:textIsSelectable="true"/>
<ListView
android:id="@+id/list1"
android:background="@color/blue"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="430dp"
android:layout_marginLeft="6dp" />
</LinearLayout>
</RelativeLayout>
當我運行應用程序時,兩個線性佈局是在彼此之上?或者上面看到的地圖片段作爲黑色矩形佔據了所有的屏幕?我不知道我做錯了什麼,我查看了幾個教程,看起來正確嗎?
需要幫助,請
感謝
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:weightSum="2"
android:background="@color/white">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<fragment
android:id="@+id/map"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
class="com.google.android.gms.maps.MapFragment"
/>
<Button
android:id="@+id/button3"
android:layout_marginLeft="34dp"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="ClickTourismButton"
android:text="@string/Tourism" />
<Button
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="34dp"
android:text="@string/Nearby" />
<Button
android:id="@+id/button2"
android:layout_marginLeft="34dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Favourites" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginLeft="34dp"
android:text="@string/Map" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayout2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:id="@+id/feedupdate1" />
<ListView
android:id="@android:id/list"
android:background="@color/red"
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"/>
<TextView
android:id="@+id/empty"
android:textIsSelectable="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"/>
<TextView
android:id="@+id/feedupdate"
android:layout_marginLeft="6dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="430dp"
android:textIsSelectable="true"/>
<ListView
android:id="@+id/list1"
android:background="@color/blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="430dp"
android:layout_marginLeft="6dp" />
</LinearLayout>
</LinearLayout>
一個組件佔用每邊? 其分成兩部分,但地圖片段佔用所有的一面,第一個列表視圖佔據了所有其他的???
使兩個線性佈局的android:weight =「1」。這將在他們之間平分屏幕。 – 2013-03-25 12:55:31
它現在分成兩部分,但一部分佔據了每一邊的所有空間?我如何給每個組件空間? – PropK 2013-03-25 13:17:51