के बाद अब एक स्लाइडिंग ड्रावर को कार्यान्वित करने के लिए वैकल्पिक तरीका है, मेरे ऐप में मेरे पास छवि बटन के साथ एक स्लाइडिंग ड्रॉवर है और जब क्लिक किया गया है तो यह छवि विवरण और जानकारी प्रदर्शित करता है। तो मूल रूप से मैं केवल इसके लिए एक एक्सएमएल फ़ाइल और एक जावा फ़ाइल का उपयोग कर रहा हूं। (लेकिन मैंने देखा है कि प्रदर्शित करने के लिए और अधिक छविबूटन और mages जोड़ने में लोड होने में कुछ समय लगता है)। और अब जब से एपीआई 17 स्लाइडिंग ड्रॉवर को छोड़कर ऐप के भविष्य के डाउनलोड के लिए मुझे थोड़ा चिंतित करता है। अब मेरा सवाल यह है कि स्लाइडिंग ड्रॉवर या स्पिनर का उपयोग किये बिना इसे हासिल करने का एक वैकल्पिक तरीका है। मैं वास्तव में प्रत्येक छवि के लिए एक एक्सएमएल और जावा फ़ाइल नहीं बनाना चाहता (मैं 100+ एक्सएमएल और जावा के साथ समाप्त हो जाऊंगा) यहां मेरा कोड है जो मेरे पास है।एपिआई 17
एक्सएमएल:
<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">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/iM1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:adjustViewBounds="true"/>
</RelativeLayout>
</ScrollView>
<SlidingDrawer
android:id="@+id/sD1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:content="@+id/content"
android:handle="@+id/handle">
<Button
android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon_1" />
<RelativeLayout
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/icon_background1">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<Button
android:id="@+id/asample"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/imageicon1"/>
.....
और जावा:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.campsites);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
final SlidingDrawer slider = (SlidingDrawer) findViewById(R.id.sD1);
final ImageView imageView = (ImageView) findViewById(R.id.iM1);
slider.animateOpen();
Button next = (Button) findViewById(R.id.asample);
Button next1 = (Button) findViewById(R.id.bsample);
..........
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
imageView.setImageDrawable(getResources().getDrawable(R.drawable.asample));
slider.animateClose();
}
});
next1.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
imageView.setImageDrawable(getResources().getDrawable(R.drawable.bsample));
slider.animateClose();
}
});
............
किसी को भी मदद या क्या करना है पर एक सुझाव है सकते हैं?
ड्रॉवरलाइट पुराने एंड्रॉइड संस्करणों के साथ भी काम करता है यह v4 समर्थन पुस्तकालय में है। – NasaGeek
आप सही हैं - मैं इसे सही करने के लिए अपना उत्तर संपादित करूंगा –