我有按钮,因为我想在所有按钮之间放置相同的空间,所以如果我在平板电脑上运行应用程序按钮之间的空间将等于鸿沟,我使用linearlayout,我知道有layout_weight选项但我不想舒展图标在linearlayout中的按钮之间做相同的空间
例如
我的XML代码如下
<LinearLayout
android:id="@+id/shareLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/btnRequestAPrescriptionRefill"
android:layout_marginTop="10dp" >
<Button
android:id="@+id/btnFacebook"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/btn_facebook" />
<Button
android:id="@+id/btnYoutube"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/btn_youtube" />
<Button
android:id="@+id/btnTwitter"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/btn_twitter" />
<Button
android:id="@+id/btnPintrest"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@drawable/btn_pintrest" />
</LinearLayout>
最后你的答案是合适的:) – 2013-02-22 10:14:24
非常感谢你Archie.bpgc – 2013-02-22 10:15:49
很好的答案。小的改进:使用<空格 的android:layout_width = “0dp” 机器人:layout_height = “1DP” 机器人:layout_weight = “1”> 代替,使你的目标在你的XML更清晰。 –
PeteH
2014-09-02 14:51:28