Android:LinearLayout 占据 100% 的 View

标签 android android-layout android-linearlayout

我希望我的图表占据 100% 的 View ,我只想查看图表。我想删除那个空白。但我得到了这个结果:

enter image description here

这是我的 XMl 布局:

 <RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.debitdistance.WifiChartsRealTime$PlaceholderFragment" >

   <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:id="@+id/chart" >
    </LinearLayout>

</RelativeLayout>

最佳答案

RelativeLayout 中删除填充:

<RelativeLayout 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"
    tools:context="com.example.debitdistance.WifiChartsRealTime$PlaceholderFragment" >

...

</RelativeLayout>

这些都是没有100%填满屏幕的原因。

关于Android:LinearLayout 占据 100% 的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23593401/

相关文章:

android - 我们如何在输入 EditText 时过滤 ListView ?

android - float ListView 项

java - 如何在android中将线性布局的所有元素设置为相同的宽度?

android - 将 ListView 项目的状态更改为以编程方式激活?

javascript - cordova:模块“cordova/plugin/SmsInboxPLugin 未找到

android - 使用 getDrawingCache 提高图像质量 - android

android - 在不使用 LinearLayout 的情况下将 ImageView 居中于父 View 的一半

java - LinearLayout onShow 它将 ScrollView 向下移动

java - 创建 Android 警报通知

android - 在android中实现自定义Edittext样式