enter image description here私はAndroidアプリを開発しています。 動的に私は(サーバーから取得した)名前を作成しましたが、今度は、同じ高さと幅のテキストのある色付きの矩形を追加する必要があります。テキストビューに色付き長方形を追加するには
開発する必要がある画像を添付しました。
どうすればこの問題を解決できますか?キャンバスを使う?私はそれが非常に難しいと思っています。 TextViewのために
enter image description here私はAndroidアプリを開発しています。 動的に私は(サーバーから取得した)名前を作成しましたが、今度は、同じ高さと幅のテキストのある色付きの矩形を追加する必要があります。テキストビューに色付き長方形を追加するには
開発する必要がある画像を添付しました。
どうすればこの問題を解決できますか?キャンバスを使う?私はそれが非常に難しいと思っています。 TextViewのために
、ちょうどこれをachiveするパディングと背景を追加します:) はこれを試してみてください:
上記<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#BBBBBB"
tools:context="xyz.mhuy.myapplication.MainActivity">
<RelativeLayout
android:id="@+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/black" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="HelloWorld"
android:padding="10dp"
android:textColor="#ffffff"
android:gravity=""/>
<TextView
android:id="@+id/button2"
android:padding="10dp"
android:background="#ff0000"
android:textColor="#ffffff"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="next"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</LinearLayout>
これは黒色のtextviewの色付きの矩形を作成しますか? – Mark023
私はちょうど私の答えを編集する: – alway5dotcom
ありがとう.... :) – Mark023
利用のTextViewとotherTextView ... – sushildlh
は、ここで私はあなたが今まで開発され、私たちの誰かが改善されるソースコードを共有 –
をあなたのXMLコードを貼り付けそれは – Mark023