我認爲這個問題已經問了很多,是的,我一直在這裏找幾個小時,沒有什麼幫助我.. 我可以顯示這張圖片的問題:Android的滾動視圖寬度全屏,也Uri.parse(位置)
http://i.imgur.com/554oMa5.png
對不起,我給的鏈接(我沒有圖像足夠的聲譽)
正如你所看到的,寬度不適合整個屏幕.. 相信我,我試了很多東西來解決它: fill_parent match_parent 比重=填寫 視=真 以及更多......
所以這裏是爲這一刻我的XML代碼:
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:background="#000000"
tools:context=".Succes" >
<ScrollView
android:id="@+id/scrollView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Button
android:id="@+id/google"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClickGoogle"
android:text="Go google" />
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClickSudan"
android:text="Go to Sudan!" />
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClickAwesome"
android:text="Awesome button" />
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="30dp"
android:gravity="center"
android:text="Rate me!"
/>
<RatingBar
android:id="@+id/lol2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numStars="5"
android:gravity="center" />
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClickHai"
android:text="Hai" />
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<SeekBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClickSuper"
android:text="Super button" />
<View
android:layout_width="fill_parent"
android:layout_height="30dp"
/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:onClick="onClickOut"
android:text="Go back" />
</LinearLayout>
</ScrollView>
我也有一個問題(沒有連接到第一一個):
public void onClickSudan(View view)
{
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
dialog.setTitle("GO TO SUDAN?");
dialog.setMessage("Are you really sure go to Sudan?" +
" By pressing yes you will not have the ability to come back!" +
" Please think good before clicking yes(think really good).");
dialog.setCancelable(true);
dialog.setPositiveButton("yes",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id)
{
//if clicked okay, go to there ;o
Uri location = Uri.parse("geo:18.130191,31.683355");
Intent start = new Intent(Intent.ACTION_VIEW, location);
startActivity(start);
}
});
dialog.setNegativeButton("No.", null);
AlertDialog dialog2 = dialog.create();
dialog2.show();
}
Uri無法識別這個座標,這裏有什麼問題? 應用程序崩潰。 如果問題出在座標上,那麼如何獲得正確的谷歌地圖座標?
感謝(:
請發佈您的整個佈局xml文件。 – NasaGeek
對不起,我編輯過(:) – hey