मुझे एक छवि दृश्य के साथ एक समस्या है जिसे मैं एक सापेक्ष लयआउट में घुमाता हूं। यहाँ मेरी समस्या है:
मैं जो चाहता हूं उसे प्राप्त करने के लिए मुझे कैसे करना चाहिए?
धन्यवाद !
मेरा जावा कोड:
previewImageView.setRotation(rotAngle);
मेरा एक्सएमएल:
<RelativeLayout
android:id="@+id/previewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.xxxx.SquareImageView
android:id="@+id/previewBackgroundImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@drawable/dark_blue_page"
/>
<com.xxxx.TouchImageView
android:id="@+id/previewImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/previewBackgroundImageView"
android:layout_alignTop="@+id/previewBackgroundImageView"
android:layout_alignEnd="@+id/previewBackgroundImageView"
android:layout_alignBottom="@+id/previewBackgroundImageView"
android:layout_margin="50dp"
android:scaleType="centerInside"
/>
</RelativeLayout>
1 उत्तर
सबसे आसान उपाय यह होगा कि ImageView को FrameLayout में लपेटा जाए
उस तरह:
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="50dp"
android:layout_alignStart="@+id/previewBackgroundImageView"
android:layout_alignTop="@+id/previewBackgroundImageView"
android:layout_alignEnd="@+id/previewBackgroundImageView"
android:layout_alignBottom="@+id/previewBackgroundImageView"
android:layout_alignLeft="@+id/previewBackgroundImageView"
android:layout_alignRight="@+id/previewBackgroundImageView" >
<com.xxxx.TouchImageView
android:id="@+id/previewImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside" />
</FrameLayout>
इस तरह FrameLayout अपने चाइल्ड व्यू के किसी भी हिस्से को FrameLayout सीमाओं से परे क्लिप कर देगा। यह दृश्य विशेषता android:clipChildren पर आधारित है, जिसमें true
का डिफ़ॉल्ट मान
कमियां: यह प्रोजेक्ट के लिए अधिक लेआउट लाता है जो संभावित रूप से एप्लिकेशन के प्रदर्शन को नुकसान पहुंचा सकता है। लेकिन वह अकेला FrameLayout अपने आप में कोई नुकसान नहीं करेगा।
संबंधित सवाल
नए सवाल
java
जावा एक उच्च स्तरीय प्रोग्रामिंग भाषा है। इस टैग का उपयोग तब करें जब आपको भाषा का उपयोग करने या समझने में समस्या हो। इस टैग का उपयोग शायद ही कभी किया जाता है और इसका उपयोग अक्सर [वसंत], [वसंत-बूट], [जकार्ता-ई], [Android], [javafx], [हडूप], [श्रेणी] और [मावेन] के साथ किया जाता है।