在android custom_toast_layout中,布局边距不起作用 [英] In android custom_toast_layout, layout margin is not working

查看:158
本文介绍了在android custom_toast_layout中,布局边距不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自定义吐司,在其中我提供了layout_margin权利,但是它对问题出在哪里没有任何建议.下面是我正在使用的代码.

I am using the custom toast and in it i am providing layout_margin right but it is not working any suggestion where is the problem.below is the code i am using.

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_toast_layout_id"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF"
android:orientation="horizontal"
android:layout_marginRight="200dip">

<ImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_marginRight="5dp" />

<TextView
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:textColor="#000" />
</LinearLayout>

推荐答案

我知道这并不完全相同,但是您可以将margin替换为padding,并且可以使用. 就您而言:

I know this is not exactly the same use, but you can replace margin by padding, and it works. In your case:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/custom_toast_layout_id"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFF"
    android:orientation="horizontal"
    android:layout_paddingRight="200dip">

<ImageView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_marginRight="5dp" />

<TextView
    android:id="@+id/text"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:textColor="#000" />
</LinearLayout>

这篇关于在android custom_toast_layout中,布局边距不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆