2016-04-18 193 views
0

這看起來像我的Android設計有問題。這裏的問題是:Textview響應邊距/填充

Here is the image

正如你所看到的, 「HTTP:// LABEL 2 GOES HERE」 是正確的標籤1文本的頂部:「這僅僅是標籤1測試.. .....「我怎麼能這樣做,以便」http:// LABEL 2 GOES HERE「將永遠在」標籤1「30dp以下,無論它有多長或多短?

我怎樣才能讓這個

這裏是我的XML文件:

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:tools="http://schemas.android.com/tools" 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android" 

    <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" 
     android:minHeight="1000dp"> 

     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:text="About:" 
     android:id="@+id/about" 
     android:textSize="16dp" 
     android:layout_marginTop="30dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 

     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:id="@+id/label1" 
     android:textSize="16dp"/> 

     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:text="Website:" 
     android:id="@+id/website" 
     android:textSize="16dp" 
     android:layout_marginTop="30dp" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 

     <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:id="@+id/label2" 
     android:textSize="16dp" 
     android:autoLink="web"/> 

    </RelativeLayout> 
</ScrollView> 
+1

您可以包括XML,你已經爲這一點。 – buczek

+0

@buczek我剛剛用XML代碼編輯了OP。 – johnny880

回答

0

你想打好下面的實際說明一切。這是我做的事情,應該爲你工作。

enter image description here

增加的大小

enter image description here

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

    <TextView 
     android:id="@+id/about" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="About:"/> 


    <TextView 
     android:id="@+id/aboutDescription" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@id/about" 
     android:text="Description \n description"/> 

    <TextView 
     android:id="@+id/website" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Website:" 
     android:layout_below="@id/aboutDescription" 
     /> 

    <TextView 
     android:id="@+id/websiteDescription" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@id/website" 
     android:layout_below="@id/aboutDescription" 
     android:text="Description \n description"/> 

</RelativeLayout> 
+0

我剛剛用XML代碼編輯了OP。 – johnny880

0

這裏是你正在尋找

什麼父母取的線性佈局和不同的線2個不同的相對佈局(不必要)

相對佈局有高度包裝內容,因此它會根據您的數據大小而增加。

enter image description here

這裏是代碼:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <TextView 
     android:id="@+id/about" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="About :" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textSize="16dp" /> 

    <TextView 
     android:id="@+id/label1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/about" 
     android:text="This is just a test for lebel 1 \nThis is just a test for lebel 1 \nThis is just a test for lebel 1 \nThis is just a test for lebel 1" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textSize="16dp" /> 
</RelativeLayout> 

<RelativeLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <TextView 
     android:id="@+id/website" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Website :" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textSize="16dp" /> 

    <TextView 
     android:id="@+id/label2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toRightOf="@+id/website" 
     android:minLines="4" 
     android:text="This is just a test for lebel 2 \nThis is just a test for lebel 2 \nThis is just a test for lebel 2 \nThis is just a test for lebel 2 \nThis is just a test for lebel 2" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:textSize="16dp" /> 
</RelativeLayout></LinearLayout>