本文介绍了Android的,从元素中删除margin和padding的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经包含的LinearLayout(水平),我想,在里面LinearLyout所有元素连接,无保证金或填充的活动。我试过很多方法,但都无济于事。
i've an activity that contains a LinearLayout (horizontal), i want that all elements inside the LinearLyout are attached, without margin or padding. I've tried many methods but to no avail.
这是我的最后一次尝试:
This is my last attempt:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.50" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:includeFontPadding="false" >
<TextView
android:id="@+id/descriptionCounter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:padding="0dp"
android:background="@null"
android:gravity="center_horizontal"
android:text="@string/text_description"
android:textColor="#33b5e5"
android:textSize="60sp"
android:includeFontPadding="false" />
<TextView
android:id="@+id/textActionCounter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:padding="0dp"
android:background="@null"
android:contentDescription="@string/text_counter"
android:gravity="center_horizontal"
android:textColor="#33b5e5"
android:textSize="140sp"
android:includeFontPadding="false" />
<TextView
android:id="@+id/previousCounter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:padding="0dp"
android:background="@null"
android:contentDescription="@string/text_counter"
android:gravity="center_horizontal"
android:textColor="#33b5e5"
android:textSize="60sp"
android:includeFontPadding="false" />
</LinearLayout>
</RelativeLayout>
我
如何解决我的问题?
How can i resolve my problem?
谢谢!
推荐答案
您可以使用Android:在的LinearLayout layout_weight财产,这将覆盖所有的填充日,
You can use android:layout_weight property in LinearLayout,this will override all th padding,
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="3">
<TextView
.
.
.
android:layout_weight="1" />
<TextView
.
.
.
android:layout_weight="1" />
<TextView
.
.
.
android:layout_weight="1" />
</LinearLayout>
这篇关于Android的,从元素中删除margin和padding的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!