2013-08-12 2 views
1

단락을 만들려는 레이아웃 파일입니다. 즉, 다음 문장은 이전 문장이 끝나는 지점부터 시작해야합니다. 그러나 이것은 일어나지 않으며 다음 문장이 다음 줄에 올 것입니다. 사실 나는 각 문장이 데이터베이스와 연결되어 있고 사용자가 선택해야하기 때문에 xml 접근 방식을 사용하고 있으므로 \n을 사용하여 선택을 할 수 없습니다.xml 레이아웃을 사용하여 여러 textviews를 사용하여 단락 만들기

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

    <ScrollView 
     android:fillViewport="true" 
     android:id="@+id/q_area" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

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

      <TextView 
       android:id="@+id/question_text" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_alignParentTop="true" 
       android:padding="10dp" 
       android:text="Q1 : Select the right sentence out of these ?" /> 

      <LinearLayout 
       android:orientation="vertical" 
       android:padding="10dp" 
       android:layout_below="@id/question_text" 
       android:layout_marginTop="25dp" 
       android:id="@+id/comprehension" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" > 

       <TextView 
        android:id="@+id/sentence1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Reading comprehension is defined as the level of understanding of a text/message." /> 

       <TextView 
        android:id="@+id/sentence2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="This understanding comes from the interaction between the words that are written and how they trigger knowledge outside ." /> 

       <TextView 
        android:id="@+id/sentence3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Proficient reading depends on the ability to recognize words quickly and effortlessly." /> 

       <TextView 
        android:id="@+id/sentence4" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Many educators in the USA believe that students need to learn to analyze text." /> 

       <TextView 
        android:id="@+id/sentence5" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="But other US educators consider this reading approach to be completely backward." /> 
      </LinearLayout> 

      <TextView 
       android:id="@+id/explanation_text" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/comprehension" 
       android:layout_marginTop="25dp" 
       android:padding="10dp" 
       android:text="Explanation: Sentence you have selected is right?" /> 

      <View 
       android:visibility="invisible" 
       android:id="@+id/user_optionset4" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/explanation_text" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="50dp" 
       /> 
     </RelativeLayout> 
    </ScrollView> 

    <LinearLayout 
     android:background="@android:color/black" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" > 

     <Button 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.3" 
      android:gravity="center" 
      android:padding="0dp" 
      android:singleLine="true" 
      android:text="P" 
      android:textColor="@android:color/black" /> 

     <Button 
      android:id="@+id/Take" 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_weight="1.4" 
      android:gravity="center" 
      android:padding="0dp" 
      android:singleLine="true" 
      android:text="Done" 
      android:textColor="@android:color/white" /> 

     <Button 
      android:layout_width="0dip" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.3" 
      android:gravity="center" 
      android:padding="0dp" 
      android:singleLine="true" 
      android:text="N" 
      android:textColor="@android:color/black" /> 
    </LinearLayout> 

</RelativeLayout> 

이 전류 출력 :

enter image description here

예상 출력 다음 문장은 화상에 나타낸 바와 같이, 노란색 화살표의 위치에서 시작해야

enter image description here

+0

시도해보십시오
태그 ?? – Zax

답변

1
아마

각 문장은 여기서 몇 가지 CSS를 첨부 웹뷰 될 것이라고이 달성의 가장 쉬운 방법 : 자세한 내용은

<string name="sample_string"><![CDATA[some test line 1 <br />some test line 2]]></string> 

당신은 아래 링크를 참조 할 수 있습니다 링크를 만들고, 그 링크는 원하는 작업을 수행 할 Java 메소드를 호출합니다. 그런 다음 모든 링크가 블록이 아니기 때문에 마지막 줄이 끝난 위치에서 줄 바꿈없이 (사용자가 특별히 선언하지 않는 한) 계속됩니다.

JS에서 자바의 호출을 달성하는 방법에 대한 몇 가지 정보이 내가 위 내 commnet에서 의미가 무엇 here

+0

마침내 내가이 방법으로 대답을했습니다 – Prateek

+0

@prateek 만약 당신이이 대답을 받아 들인다면 아래의 자신 만의 대답을 삭제하십시오 !! – sachin10

0

각 텍스트 끝에
을 사용할 수 있습니다. 그러나 resource 아래의 string.xml에 문자열/Message를 정의해야합니다. 아래의 예는 다음과 같습니다 LINK

+0

왜 '
'을 사용해야합니까? 다음 줄이 오지 않게하려면 텍스트가 자동 완성되어 문장 완성을 기반으로하지 말아야합니다. – Prateek

+0

linearlayout을 사용하고 있으므로 각 텍스트보기가 다른 아래에 올 것입니다. – Sushil

+0

@Sushil 그래서 어떻게해야합니까? 이것을 피하기 위해 Box 레이아웃이이 경우에만 도움이 될 수 있다고 생각했습니다. 그래서 LinearLayout을 선택했습니다. – Prateek

0

찾을 수 있습니다. strings.xml에 하나의 String을 만들어야합니다. 이
등 Thne 당신의 텍스트 뷰에있는 문자열을 사용하여 적절한 alignmnet를 수행합니다.

이 개인 정보 보호 정책이 어떻게 XXX 용도를 설정하고이 응용 프로그램을 사용할 때의 XXX을주는 정보를 보호 \ n \ n

xxx는 귀하의 개인 정보가 보호되도록 최선을 다하고 있습니다. 이 앱을 사용할 때 식별 할 수있는 특정 정보를 제공하도록 요청하면이 개인 정보 취급 방침에 따라 사용할 수 있음을 확신 할 수 있습니다. \ n \ n

xxx는이 정책을 변경할 수 있습니다. 이 페이지를 업데이트하여 수시로 이 페이지를 수시로 확인하여 변경 사항에 만족하는지 확인하십시오. 이 정책은 2013 년 6 월 1 일부터 효과가있다 \ n \ n

우리가가 \ n \ n

우리는 다음과 같은 정보를 수집 할 수 있습니다 수집 무엇

이름과 직책 \ n을 • 문의 • \ n 이메일 주소 \ n을 포함한 정보 우편 번호, 환경 설정 및 관심 고객 설문 조사 및/또는 이벤트에 N 기타 정보 • 관련 \ 등 • 인구 통계 학적 정보 \ n 우리는 우리가 수집 한 정보로 무엇을 : \ n \ n

이 정보를 이해하려면 귀하의 필요를 채우고 더 나은 서비스를 제공 할 수 있습니다. 특히 다음과 같은 이유가 있습니다. \ n • 내부 기록 보관.\ n • Google은 제품과 서비스를 개선하기 위해 정보를 사용할 수 있습니다. \ n • 제공 한 이메일 주소를 사용하여 흥미있는 것으로 생각되는 신제품, 특별 할인 또는 기타 정보에 대한 홍보 이메일을 주기적으로 보낼 수 있습니다 \
때때로, 우리는 시장 조사 목적으로 귀하의 정보를 이용하기도합니다. 우리는 이메일, 전화, 팩스 또는 메일로 연락 할 수 있습니다. \ n 을 우리는 귀하의 관심에 따라 응용 프로그램을 사용자 정의 정보를 사용할 수 • 있습니다. \ n \ n

보안 \ n \ n

우리는 귀하의 정보가 안전함을 보장하기 위해 노력합니다. 무단 액세스 또는 공개를 방지하기 위해 우리는 온라인 장소에서 보호하고 우리가 수집 한 정보를 보호하기 위해 적절한 물리적, 전자적 및 관리 절차를 뒀다. \ n \ n 우리가 쿠키 \ n \ n

를 사용하는 방법

쿠키는 로컬 저장소에 배치 할 수있는 권한을 요청하는 작은 파일입니다. 동의하면 파일이 추가되고 쿠키는 웹 트래픽을 분석하는 데 도움이되거나 특정 사이트를 방문했을 때 알려줍니다. 쿠키를 사용하면 웹 응용 프로그램이 개인으로 응답 할 수 있습니다. 웹 응용 프로그램은 사용자의 기본 설정에 대한 정보를 수집하고 기억하여 요구 사항, 좋아요 및 싫어요에 맞게 작업을 조정할 수 있습니다. \ n Google은 트래픽 로그 쿠키를 사용하여 사용중인 페이지를 식별합니다. 이를 통해 웹 페이지 트래픽에 대한 데이터를 분석하고 앱을 개선하여 고객의 요구에 맞출 수 있습니다. 이 정보는 통계 분석 목적으로 만 사용되며 시스템에서 데이터가 제거됩니다. \ n 전반적으로 쿠키는 유용한 페이지와 유용하지 않은 페이지를 모니터링하여 더 나은 앱을 제공하는 데 도움이됩니다. 쿠키를 사용하면 귀하가 당사에 공유하도록 선택한 데이터 이외에 귀하의 컴퓨터 나 귀하에 관한 정보에 접근 할 수 없습니다. \ n 쿠키를 수락하거나 거절 할 수 있습니다. 대부분의 브라우저는 자동으로 쿠키를 허용하지만 일반적으로 원하는 경우 쿠키를 거부하도록 브라우저 설정을 수정할 수 있습니다. 이로 인해 귀하가 앱을 최대한 활용하지 못하게 될 수 있습니다.

</string> 
+0

음 나는 방금 내 문제를 해결하고 시간 내 주셔서 감사합니다. – Prateek

+0

다른 사람들에게 맞는 답을 게시하고 다른 사람들이 올바른 대답을 알 수 있도록 받아 들일 수 있습니다. – Sushil

+0

은 – Prateek

0

android에서 flowlayout과 같은 것을 사용할 수 있습니다. 나는 그것을 사용할 기회가 없다. 그러나 FlowLayout의 커스텀 구현은 다음과 같다. https://github.com/ApmeM/android-flowlayout

참고 : 위의 라이브러리를 사용하기 위해서는 정확한 단계와 방법을 찾아야 할 것이다. 어쩌면 주변에 누군가가 너를 도울 수 있었다.

+0

을 확인할 수 있습니다. 나는 방금 문제를 해결했으며 시간 내 주셔서 감사합니다. – Prateek

0

마침내 내가 실제로 도움이 된 것은 webview이었다. 또한 레이아웃이 매우 동적이어서 webview 안에 표시되는 내용이 sqlite에서 나왔기 때문에 대규모 작업을 수행하려면 javascript을 사용해야합니다.

+0

@dreamsonfire 여기에 귀하의 의견의 중요성은 무엇입니까? – Prateek

+0

내가 원하는대로 제거 :) – sachin10

관련 문제