我有這個xml文檔。我想要這93個93像素的按鈕圖像等距。目前,體重的設置使他們伸展並彼此擁抱,所以沒有空間。但是,如果我將體重設置爲0,他們會相互擁抱,但會填滿屏幕的大約一半。等間距固定大小按鈕Android
這是爲了橫向的方式。
<LinearLayout android:id="@+id/LinearLayout" android:layout_height="wrap_content"
android:layout_width="fill_parent">
<Button
android:background="@drawable/a"
android:layout_height="93px"
android:id="@+id/a"
android:layout_width="93px"
android:layout_weight="1"
android:layout_marginLeft="20dip"
android:layout_marginTop="30dip"/>
<Button
android:background="@drawable/b"
android:layout_height="93px"
android:id="@+id/b"
android:layout_width="93px"
android:layout_weight="1"
android:layout_marginTop="30dip"/>
<Button
android:background="@drawable/c"
android:layout_height="93px"
android:id="@+id/c"
android:layout_weight="1"
android:layout_width="93px"
android:layout_marginTop="30dip"/>
<Button
android:background="@drawable/d"
android:layout_height="93px"
android:id="@+id/d"
android:layout_width="93px"
android:layout_weight="1"
android:layout_marginRight="20dip"
android:layout_marginTop="30dip" />
</LinearLayout>
一個
感謝那些看起來很完美,這和其他佈局的問題,我有。如果你可以花一分鐘來簡單地解釋如何實現這將是偉大的。一旦我將該文件放入我的apk中,我應該從那裏做什麼? – Somk 2011-05-28 12:17:42
@Max:請參閱http://code.google.com/p/iosched/source/browse/android/res/layout/fragment_dashboard.xml – CommonsWare 2011-05-28 12:23:11
您發給我的第一個鏈接我應該保存爲com.google.android。 apps.iosched.ui.widget與我的所有其他軟件包在scr下正確嗎? – Somk 2011-05-28 15:06:41