gpt4 book ai didi

android - xml中行间距

转载 作者:行者123 更新时间:2023-11-30 01:32:29 26 4
gpt4 key购买 nike

我想要这个:

enter image description here

我得到的是这个:

enter image description here

我的 xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<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="autogenie.plandetail.MainActivity">

<android.support.v7.widget.Toolbar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/view"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true" />

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_below="@+id/view"
android:layout_alignParentStart="true"
android:id="@+id/relativeLayout">

<ImageView
android:layout_width="100dp"
android:layout_height="fill_parent"
android:id="@+id/imageView"
android:layout_centerVertical="true"
android:layout_alignParentStart="true"
android:src="@drawable/abc_list_selector_disabled_holo_dark" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Plan:"
android:id="@+id/textView"
android:layout_alignParentTop="true"
android:layout_toEndOf="@+id/imageView"
android:textColor="#000000"
android:textStyle="bold" />

<TextView
android:textColor="#000000"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Monthly Rental:"
android:id="@+id/textView2"
android:layout_below="@+id/textView"
android:layout_toEndOf="@+id/imageView" />

<TextView
android:textColor="#000000"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Free Data:"
android:id="@+id/textView3"
android:layout_below="@+id/textView2"
android:layout_toEndOf="@+id/imageView" />

<TextView
android:textColor="#000000"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Overage Charge:"
android:id="@+id/textView4"
android:layout_below="@+id/textView3"
android:layout_toEndOf="@+id/imageView" />

<TextView
android:textColor="#000000"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Network:"
android:id="@+id/textView5"
android:layout_below="@+id/textView4"
android:layout_toEndOf="@+id/imageView" />

<TextView
android:textColor="#000000"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Remarks:"
android:id="@+id/textView6"
android:layout_below="@+id/textView5"
android:layout_toEndOf="@+id/imageView" />
</RelativeLayout>

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/relativeLayout"
android:layout_centerHorizontal="true">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Features"
android:id="@+id/textView7"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:textStyle="bold" />

<TextView
android:textColor="#000000"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/textView8"
android:layout_alignParentStart="true"
android:layout_below="@+id/textView7"
android:text="@string/features" />

<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Continue"
android:id="@+id/button"
android:layout_below="@+id/textView8"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:textColor="#ffffff"
android:background="#2c75ba"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</RelativeLayout>

我做错了什么?

我的设计看起来不错:

http://i.stack.imgur.com/pdLBW.png

我在一个 TextView 中编写了整个文本并引用了字符串资源:

<resources>
<string name="app_name">Plandetail</string>
<string name="features"> &#xA;3GPLUS network &#xA;&#xA;5 WiFi-enabled Devices-Smartphone,Laptop,Tablets
&#xA; &#xA;Works with Laptop USB,Car Charger and Travel Charger &#xA;&#xA;Plug and Play &#xA; &#xA;
EVDO Rev.B 800/1900 MHz-14.7Mbps/5.4Mbps &#xA; &#xA;WiFi 802.11b/g/n &#xA; &#xA;Dual LED indicators for Wi-Fi and Network &#xA; &#xA;Works with Laptop USB,Car Charger and Travel Charger&#xA; &#xA;</string>
</resources>

最佳答案

亲爱的,这样试试效果很好

像下面这样在字符串xml中创建String

    <string name="text">3G Plus network \n\n 5wifi </string>

并在您的 TextView 文本中使用它

用这个替换你的字符串

 <string name="text">\n3GPLUS network\n\n5 WiFi-enabled Devices-Smartphone,Laptop,Tablets\n\nWorks with Laptop USB,Car Charger and Travel Charger\n\nPlug and Play\n\n
EVDO Rev.B 800/1900 MHz-14.7Mbps/5.4Mbps\n\nWiFi 802.11b/g/n\n\nDual LED indicators for Wi-Fi and Network\n\nWorks with Laptop USB,Car Charger and Travel Charger</string>

关于android - xml中行间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35570556/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com