2017-09-16 14 views

答えて

1

あなたはラインでTextViewを取得するには、このコードを使用することができます。

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

    <TextView 
     android:id="@+id/tv_textview" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Device" 
     android:layout_centerVertical="true" 
     android:layout_margin="3dp" 
     /> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:background="#000" 
     android:layout_centerVertical="true" 
     android:layout_toRightOf="@+id/tv_textview" 
     android:layout_margin="3dp" 
     /> 

</RelativeLayout> 
1
  • match_parent
  • セットの向き0dp幅とweight = 1

    <View 
        android:layout_width="fill_parent" 
        android:layout_height="1dp"  
        android:background="#000" 
        android:gravity="bottom" /> 
    
wrap_content
  • プット・ビューの垂直

  • プットテキストビューの子を持つ線形レイアウトを作成
  • 0

    ようProgramiticallyそれを実行してください。..

    yourTextView.setText("Device_________________________"); 
    yourTextView.setTextColor("Your Color Here"); 
    

    Androidの設定したXMLファイル(ラインを作るために使用_)

    :幅= "MatchParent"。

    テキストビュー。

    これは、スタティックレイアウトを作成する場合にのみ行います。

    0

    .. Drawableの textviewthisのようなものをカスタム描画可能とdrawableEndに設定をすることができ描き とtextviewmatch parent

    を設定するのを忘れないでください
    関連する問題