簡體   English   中英

如何在Android上塑造Web視圖?

[英]How can I shape a webview on Android?

我想在不影響背景圖片的情況下填充textview,但是當我在相對布局上進行填充時,當我嘗試從textview進行填充時,它會從所有周圍裁剪背景,從而裁剪了我的文本

這是我的代碼

<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=".TesbihMainActivity" >

    <ImageView
        android:id="@+id/backroundimage"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:scaleType="centerCrop"
        android:src="@drawable/tesbihbackround"
         />

    <TextView

        android:id="@+id/display"
        android:layout_width="fill_parent"
        android:layout_height="63dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:background="#e9ebec"
        android:text=" 385 "
        android:gravity="center"
        android:textSize="52dp"
        android:textColor="#3c677b"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>

在TextView上使用Margin,而不是Padding。

填充會在視圖內部增加空間。 保證金增加了外部空間!

例如:在TextView上填充將使TextView的內容遠離TextView的邊界。 TextView上的邊距將使整個TextView遠離其父級的邊界。

您可以在android:layout_margin=""使用android:layout_margin=""代替android:padding="" 這將在TextView中向textView的所有方向(上,下,左,右)插入一個帶有空白值的邊距

如果要應用特定的邊距,也可以使用以下這些:

android:layout_marginLeft=""
android:layout_marginTop=""
android:layout_marginRight=""
android:layout_marginBottom=""

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM