如何在另一个活动中访问变量值.在我的例子中,我有一个字符串变量项,其值是微调器选择的值.如何在不使用Intent的情况下在另一个活动中访问此变量?
public class LoginScreen extends Activity {
Spinner sp;
String item;
Spinner sp = (Spinner) findViewById(R.id.lgnspinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
this, R.array.network_array,
android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(adapter);
sp.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view,
int position, long id) {
item = (String) parent.getItemAtPosition(position);
public class AgAppMenu extends Activity {
Run Code Online (Sandbox Code Playgroud) 这是我下面的代码,它显示按钮中的图像工作正常但我想最小化图像和按钮之间的空间.我怎么做?
请帮助我如何最小化图像和文本之间的空间.这是我的图片网址 http://imgur.com/Jmvqe
<Button android:id="@+id/MyAccountbutton"
style="?android:attr/buttonStyleSmall"
android:layout_height="25dip"
android:layout_width="fill_parent"
android:layout_marginRight="55dip"
android:layout_marginLeft="55dip"
android:drawableLeft="@drawable/handshake"
android:paddingLeft="10dip"
android:background="@drawable/curvedplanebutton"
android:textColor="@drawable/button_text_color"
android:layout_marginTop="15dip"
android:text="Payments"/>
Run Code Online (Sandbox Code Playgroud) 这是我的嵌套布局如何将其角落更改为曲线?图像网址1是一个示例我想做的曲线像实现inblack浆果图像url 2是我的Android代码如何曲线布局像那样?url1是http://imgur.com/dFUVF url 2是 http://imgur.com/UMffI
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="500dp"
android:background="#D3D3D3"
android:orientation="vertical"
android:paddingLeft="3dip"
android:paddingRight="3dip"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="120dp"
android:background="#333333"
android:orientation="horizontal" >
<Button
android:id="@+id/btnMiniStatement"
style="@style/HomeButton"
android:layout_width="wrap_content"
android:drawableTop="@drawable/home_button1"
android:onClick="onClickFeature"
android:text="MINI STATEMENT" />
<Button
android:id="@+id/btnBalanceInquiry"
style="@style/HomeButton"
android:layout_width="wrap_content"
android:drawableTop="@drawable/home_button2"
android:onClick="onClickFeature"
android:text="Balance Inquiry" />
<Button
android:id="@+id/btnUtilityBalanceInquiry"
style="@style/HomeButton"
android:layout_width="wrap_content"
android:drawableTop="@drawable/home_button3"
android:onClick="onClickFeature"
android:text="Utility Balance Inquiry" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) 我找到了一个解决方案如何在openstreet地图中映射气球我根据自己的需要定制osmbonuspack工作正常,但只显示一张地图.
如何在此代码中添加多个标记,我将在下面粘贴?
我的输出网址工作正常,请告诉我如何在图像气泡中添加文字以及如何在地图中添加多个标记?
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.osmbonuspackdemo.R;
public class NavigationActivity extends Activity
{
protected MapView map;
protected ItemizedOverlayWithBubble<ExtendedOverlayItem> markerOverlays;
protected ExtendedOverlayItem markerStart;
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
map = (MapView) findViewById(R.id.map);
map.setBuiltInZoomControls(true);
map.setMultiTouchControls(true);
MapController mapController = map.getController();
GeoPoint myPoint1 = new GeoPoint(24.893379000000000000, 67.028060900000010000);
mapController.setZoom(9);
mapController.setCenter(myPoint1);
final ArrayList<ExtendedOverlayItem> waypointsItems = new ArrayList<ExtendedOverlayItem>();
markerOverlays = new ItemizedOverlayWithBubble<ExtendedOverlayItem>(this, waypointsItems, map);
map.getOverlays().add(markerOverlays);
markerStart = putMarkerItem(null, myPoint1, "Start", R.drawable.marker_a, R.drawable.rogger_rabbit);
}
public ExtendedOverlayItem putMarkerItem(ExtendedOverlayItem item, GeoPoint …Run Code Online (Sandbox Code Playgroud) 如何在Android上的微调器上放置图像图标请帮助我这是我的spiner代码如何在列表中的每个名称上添加图像?我想在微调器上的eact文本上显示图像
Spinner sp = (Spinner) findViewById(R.id.lgnspinner);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.network_array,
android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sp.setAdapter(adapter);
sp.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
// text}
if (position == 1) {
// text
}
if (position == 2)
{
// text
}
if (position == 3) {
// text
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
XML:
<Spinner
android:id="@+id/lgnspinner"
style="?android:attr/buttonStyleSmall"
android:layout_width="145dip"
android:layout_height="wrap_content"
android:prompt="@string/network_prompt"
android:textColor="#000000" />
<string-array name="network_array" >
<item>
GPRS
</item>
<item>
Wifi
</item> …Run Code Online (Sandbox Code Playgroud)