Oen44
Oen44

Reputation: 3206

Android - Java&XML - Break Line with Buttons

I need the best solution to separate buttons by adding break line.
I tried string \n but it's not working.
It crashes the application.

Any idea?

I'm trying to create applications with buttons to access websites faster.

<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button_so" android:text="@string/stack" android:onClick="goToSo" android:lines="1"/>
<Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/superuser" android:id="@+id/button_su" android:onClick="goToSu" />

Upvotes: 0

Views: 128

Answers (1)

Shadik Khan
Shadik Khan

Reputation: 1215

<LinearLayout 
     android:id="@+id/topHourlyLayout"  
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"


    >

       <Button android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:id="@+id/button_so" 
android:text="@string/stack" 
android:onClick="goToSo" 
android:lines="1"
android:margin_bottom="7dp"/> 



<Button android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:text="@string/superuser" 
android:id="@+id/button_su" 
android:onClick="goToSu"/>

    </LinearLayout>

Upvotes: 2

Related Questions