1
我正在構建一個與鏡像一起工作的應用程序,而我的問題是如何創建鏡像佈局?我想看到所有的TextView的按鈕..就像我從鏡子看(無法讀取文本..)創建一個鏡像佈局
有什麼辦法做到這一點?鏡文本
示例 -
我正在構建一個與鏡像一起工作的應用程序,而我的問題是如何創建鏡像佈局?我想看到所有的TextView的按鈕..就像我從鏡子看(無法讀取文本..)創建一個鏡像佈局
有什麼辦法做到這一點?鏡文本
示例 -
您可以在您的佈局設置setScaleY(-1f)
實現這一目標。
所以,你的主要佈局看起來是這樣的(immitating您的示例圖像):
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/source_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:text="LOREM"
android:textColor="#0084E2"/>
<TextView
android:id="@+id/copy_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#0084E2"
android:scaleY="-1"
android:text="LOREM"
android:textColor="@android:color/white"/>
</LinearLayout>
第二View
(或ViewGroup
)必須是你的第一個完全相同的副本。您可以創建自定義ViewGroup
,該自定義會自動創建View
的副本並將其scaleY
設置爲-1f
。
看看這裏https://github.com/HannahMitt/HomeMirror –
它與我的問題無關..我不需要任何相機功能.. – Nirel