0

일부 텍스트보기 및 버튼이 포함 된 Android 애플리케이션을 개발 중입니다.다중 텍스트 TextView에서 TextView가 끝난 직후 버튼?

텍스트보기 바로 뒤에 Button을 넣어야합니다. 내 TextView가 잘 작동하는 단일 선일 때. 그러나 여러 줄의 텍스트보기를 사용하는 경우 내 버튼이 1 줄 끝까지 배치되었습니다.

버튼을 텍스트보기의 마지막 줄 끝에서 올바른 위치에 배치하는 방법은 무엇입니까?

편집 후 :
이것은 내 xml입니다. 내 코드에서 사용하고 동적으로 생성합니다.

<TableLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:paddingTop="10dp" 
android:shrinkColumns="1" 
android:stretchColumns="1" > 

    <TableRow android:id="@+id/tableRow1" > 
<Button 
    android:id="@+id/ayehPlace_btnCounter" 
    style="?android:attr/buttonStyleSmall" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/ayeh_counter" 
    android:text="" /> 
<TextView 
    android:id="@+id/ayehPlace_txtAyeh" 
    android:layout_width="wrap_content" 
    style="@style/ayehPlace_txt" 
    android:layout_height="wrap_content" 
    android:text="" /> 
</TableRow> 
</TableLayout> 
+0

android : baselineAligned = "" – KOTIOS

+2

레이아웃 코드를 입력하거나 대략적인 스케치를 표시하십시오. –

+0

당신은 (아마도) 수평'LinearLayout'에서'android : gravity = "bottom"을 찾고있는 것처럼 들립니다. –

답변

0

사용 RelativeLayout의 및 버튼에

android:layout_toRightOf="@+id/textviewid" 

를 추가합니다.

+0

그래도 버튼이 텍스트보기의 줄 끝에 가로로 배치되어 작동하지 않습니다. – user2518719

0

나는 테이블 레이아웃 instead..it를 사용하는 것을 선호합니다는 UI를 균일하게하고 자동으로

<TableLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="match_parent" 
     android:padding="5dp" 
     android:shrinkColumns="1" 
     android:stretchColumns="1" > 

     <TableRow android:id="@+id/tableRow1" > 

      <TextView 
       android:id="@+id/textView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Main Status    " 
       android:textAppearance="?android:attr/textAppearanceMedium" /> 

      <Button 
       android:id="@+id/retentionMainStatus" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="CLICK ME" /> 
</TableRow> 
</TableLayout> 
+0

여전히 작동하지 않습니다. 가로로 한 줄의 버튼 끝 부분 – user2518719

+0

여기에 XML을 게시하십시오 ... –

+0

게시 내 질문에, 귀하의 atention에 대한 탱크 – user2518719

0

를 사용하여 테이블 레이아웃 대신 .... 그것은 나를 위해 일한 ..

<TableLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:paddingTop="10dp" 
    android:shrinkColumns="1" 
    android:stretchColumns="1" > 

    <TableRow 
     android:descendantFocusability="beforeDescendants" 
     android:focusable="true" 
     android:focusableInTouchMode="true" > 

     <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Your Text" /> 

     <Button 
      android:id="@+id/button_id" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text=""/> 
    </TableRow> 
    </TableLayout> 
+0

그게 작동하지 않습니다. 내 xml을 질문에 추가하십시오. – user2518719

+0

android : layout_width를 숫자 값으로 수정하십시오. 예 : android : layout_width = "120dp" android : layout_height = "wrap_content" android : text = "Lorem ipsum dolor sit amet, consectetur" android : maxLines = "5" android : lines = "5" – ryderz8

0
를 조정

나는 TableLayout을 android : gravity = "bottom"과 함께 사용해야한다고 생각한다. 시도 해봐.

+0

작동하지 않지만 탱크 – user2518719

관련 문제